From 56ffb88b16369ea34c3233ed142ec7871256bb99 Mon Sep 17 00:00:00 2001
From: AiiR <22158489+ImAiiR@users.noreply.github.com>
Date: Thu, 30 Apr 2020 04:27:06 -0400
Subject: [PATCH] 0.9.9.13
0.9.9.13
---
QobuzDownloaderX/App.config | 3 +
QobuzDownloaderX/Form1.Designer.cs | 35 +-
QobuzDownloaderX/Form1.cs | 1287 ++---------------
QobuzDownloaderX/Properties/AssemblyInfo.cs | 4 +-
.../Properties/Settings.Designer.cs | 12 +
QobuzDownloaderX/Properties/Settings.settings | 3 +
6 files changed, 207 insertions(+), 1137 deletions(-)
diff --git a/QobuzDownloaderX/App.config b/QobuzDownloaderX/App.config
index c9be9f4..e50e13c 100644
--- a/QobuzDownloaderX/App.config
+++ b/QobuzDownloaderX/App.config
@@ -109,6 +109,9 @@
0
+
+ 1
+
diff --git a/QobuzDownloaderX/Form1.Designer.cs b/QobuzDownloaderX/Form1.Designer.cs
index 4770591..ab0662b 100644
--- a/QobuzDownloaderX/Form1.Designer.cs
+++ b/QobuzDownloaderX/Form1.Designer.cs
@@ -103,6 +103,8 @@
this.hiddenTextPanel = new System.Windows.Forms.Panel();
this.downloadFaveAlbumsBG = new System.ComponentModel.BackgroundWorker();
this.downloadFaveArtistsBG = new System.ComponentModel.BackgroundWorker();
+ this.artSizeSelect = new System.Windows.Forms.ComboBox();
+ this.artSizeLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.albumArtPicBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.logoBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.profilePictureBox)).BeginInit();
@@ -937,12 +939,41 @@
//
this.downloadFaveArtistsBG.DoWork += new System.ComponentModel.DoWorkEventHandler(this.downloadFaveArtistsBG_DoWork);
//
+ // artSizeSelect
+ //
+ this.artSizeSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.artSizeSelect.FormattingEnabled = true;
+ this.artSizeSelect.Items.AddRange(new object[] {
+ "max",
+ "600",
+ "300",
+ "150",
+ "100",
+ "50"});
+ this.artSizeSelect.Location = new System.Drawing.Point(634, 538);
+ this.artSizeSelect.Name = "artSizeSelect";
+ this.artSizeSelect.Size = new System.Drawing.Size(121, 21);
+ this.artSizeSelect.TabIndex = 96;
+ this.artSizeSelect.SelectedIndexChanged += new System.EventHandler(this.artSizeSelect_SelectedIndexChanged);
+ //
+ // artSizeLabel
+ //
+ this.artSizeLabel.AutoSize = true;
+ this.artSizeLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102)))));
+ this.artSizeLabel.Location = new System.Drawing.Point(530, 541);
+ this.artSizeLabel.Name = "artSizeLabel";
+ this.artSizeLabel.Size = new System.Drawing.Size(246, 13);
+ this.artSizeLabel.TabIndex = 97;
+ this.artSizeLabel.Text = "Embedded Art Size: px";
+ //
// QobuzDownloaderX
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
- this.ClientSize = new System.Drawing.Size(938, 533);
+ this.ClientSize = new System.Drawing.Size(938, 733);
+ this.Controls.Add(this.artSizeSelect);
+ this.Controls.Add(this.artSizeLabel);
this.Controls.Add(this.hiddenTextPanel);
this.Controls.Add(this.logoutLabel);
this.Controls.Add(this.profilePictureBox);
@@ -1100,6 +1131,8 @@
private System.Windows.Forms.Panel hiddenTextPanel;
private System.ComponentModel.BackgroundWorker downloadFaveAlbumsBG;
private System.ComponentModel.BackgroundWorker downloadFaveArtistsBG;
+ private System.Windows.Forms.ComboBox artSizeSelect;
+ private System.Windows.Forms.Label artSizeLabel;
}
}
diff --git a/QobuzDownloaderX/Form1.cs b/QobuzDownloaderX/Form1.cs
index 81eded7..2583940 100644
--- a/QobuzDownloaderX/Form1.cs
+++ b/QobuzDownloaderX/Form1.cs
@@ -55,6 +55,7 @@ namespace QobuzDownloaderX
public string formatIdString { get; set; }
public string audioFileType { get; set; }
public string trackRequest { get; set; }
+ public string artSize { get; set; }
public int MaxLength { get; set; }
public int devClickEggThingValue { get; set; }
@@ -62,6 +63,10 @@ namespace QobuzDownloaderX
private void Form1_Load(object sender, EventArgs e)
{
+ // Set main form size on launch and bring to center.
+ this.Height = 533;
+ this.CenterToScreen();
+
// Welcome the user after successful login.
output.Invoke(new Action(() => output.Text = String.Empty));
output.Invoke(new Action(() => output.AppendText("Welcome " + displayName + "!\r\n")));
@@ -120,6 +125,8 @@ namespace QobuzDownloaderX
flacHighCheckbox.Checked = Settings.Default.quality4;
formatIdString = Settings.Default.qualityFormat;
audioFileType = Settings.Default.audioType;
+ artSizeSelect.SelectedIndex = Settings.Default.savedArtSize;
+ artSize = artSizeSelect.Text;
#endregion
// Check if there's no selected path saved.
@@ -491,6 +498,13 @@ namespace QobuzDownloaderX
try
{
+ // Make sure buttons are disabled during downloads.
+ mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = false));
+ flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = false));
+ flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = false));
+ flacHighCheckbox.Invoke(new Action(() => flacHighCheckbox.Visible = false));
+ downloadButton.Invoke(new Action(() => downloadButton.Enabled = false));
+
// Set "loc" as the selected path.
loc = folderBrowserDialog.SelectedPath;
@@ -858,7 +872,7 @@ namespace QobuzDownloaderX
if (streamableCheckbox.Checked == true)
{
output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
else
@@ -875,7 +889,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(discogPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
}
@@ -884,7 +898,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(discogPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + " (" + versionName + ")" + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
}
@@ -942,6 +956,12 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg"))
{
// Skip, don't re-download.
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ using (WebClient imgClient = new WebClient())
+ {
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
}
else
{
@@ -952,6 +972,9 @@ namespace QobuzDownloaderX
{
// Download max quality Cover Art to "Cover.jpg" file in chosen path.
imgClient.DownloadFile(new Uri(frontCoverImg), loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
}
}
}
@@ -980,7 +1003,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to MP3 file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -1103,7 +1126,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -1233,7 +1256,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -1354,7 +1377,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -1504,9 +1527,15 @@ namespace QobuzDownloaderX
return;
}
+ // Delete image file used for tagging
+ if (System.IO.File.Exists(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg"))
+ {
+ System.IO.File.Delete(loc + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
+
// Say when a track is done downloading, then wait for the next track / end.
output.Invoke(new Action(() => output.AppendText("Track Download Done!\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
}
// Say that downloading is completed.
@@ -1596,6 +1625,13 @@ namespace QobuzDownloaderX
try
{
+ // Make sure buttons are disabled during downloads.
+ mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = false));
+ flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = false));
+ flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = false));
+ flacHighCheckbox.Invoke(new Action(() => flacHighCheckbox.Visible = false));
+ downloadButton.Invoke(new Action(() => downloadButton.Enabled = false));
+
// Set "loc" as the selected path.
loc = folderBrowserDialog.SelectedPath;
@@ -1963,7 +1999,7 @@ namespace QobuzDownloaderX
if (streamableCheckbox.Checked == true)
{
output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
else
@@ -1980,7 +2016,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(discogPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
}
@@ -1989,7 +2025,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(discogPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + " (" + versionName + ")" + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
}
@@ -2047,6 +2083,12 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg"))
{
// Skip, don't re-download.
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ using (WebClient imgClient = new WebClient())
+ {
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
}
else
{
@@ -2057,6 +2099,9 @@ namespace QobuzDownloaderX
{
// Download max quality Cover Art to "Cover.jpg" file in chosen path.
imgClient.DownloadFile(new Uri(frontCoverImg), loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
}
}
}
@@ -2085,7 +2130,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to MP3 file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -2208,7 +2253,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -2338,7 +2383,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -2459,7 +2504,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -2609,9 +2654,15 @@ namespace QobuzDownloaderX
return;
}
+ // Delete image file used for tagging
+ if (System.IO.File.Exists(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg"))
+ {
+ System.IO.File.Delete(loc + "\\" + "- Labels" + "\\" + labelName + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
+
// Say when a track is done downloading, then wait for the next track / end.
output.Invoke(new Action(() => output.AppendText("Track Download Done!\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
}
// Say that downloading is completed.
@@ -2699,6 +2750,13 @@ namespace QobuzDownloaderX
try
{
+ // Make sure buttons are disabled during downloads.
+ mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = false));
+ flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = false));
+ flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = false));
+ flacHighCheckbox.Invoke(new Action(() => flacHighCheckbox.Visible = false));
+ downloadButton.Invoke(new Action(() => downloadButton.Enabled = false));
+
// Set "loc" as the selected path.
loc = folderBrowserDialog.SelectedPath;
@@ -3066,7 +3124,7 @@ namespace QobuzDownloaderX
if (streamableCheckbox.Checked == true)
{
output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
else
@@ -3083,7 +3141,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(discogPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
}
@@ -3092,7 +3150,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(discogPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + " (" + versionName + ")" + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
}
@@ -3150,6 +3208,12 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg"))
{
// Skip, don't re-download.
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ using (WebClient imgClient = new WebClient())
+ {
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
}
else
{
@@ -3160,6 +3224,9 @@ namespace QobuzDownloaderX
{
// Download max quality Cover Art to "Cover.jpg" file in chosen path.
imgClient.DownloadFile(new Uri(frontCoverImg), loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
}
}
}
@@ -3188,7 +3255,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to MP3 file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -3311,7 +3378,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -3441,7 +3508,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -3562,7 +3629,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -3712,9 +3779,15 @@ namespace QobuzDownloaderX
return;
}
+ // Delete image file used for tagging
+ if (System.IO.File.Exists(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg"))
+ {
+ System.IO.File.Delete(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
+
// Say when a track is done downloading, then wait for the next track / end.
output.Invoke(new Action(() => output.AppendText("Track Download Done!\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
}
// Say that downloading is completed.
@@ -3761,1100 +3834,7 @@ namespace QobuzDownloaderX
// Favorite Artists [Not worked on at all yet]
private async void downloadFaveArtistsBG_DoWork(object sender, DoWorkEventArgs e)
{
- #region Artists
- string loc = folderBrowserDialog.SelectedPath;
-
- trackIdString = albumId;
-
- WebRequest artistwr = WebRequest.Create("https://www.qobuz.com/api.json/0.2/favorite/getUserFavorites?type=albums&limit=9999999999&user_id=" + userID + "&app_id=" + appid + "&user_auth_token=" + userAuth);
-
- // Empty output, then say Starting Downloads.
- output.Invoke(new Action(() => output.Text = String.Empty));
- output.Invoke(new Action(() => output.AppendText("FAVORITE DOWNLOADS MAY HAVE SOME ERRORS, THIS IS A NEW FEATURE, AND CURRENTLY ONLY SUPPORTS FAVORITED ALBUMS. IF YOU RUN INTO AN ISSUE, PLEASE REPORT IT ON GITHUB!\r\n")));
- output.Invoke(new Action(() => output.AppendText("Grabbing Album IDs...\r\n\r\n")));
-
- try
- {
- WebResponse artistws = artistwr.GetResponse();
- StreamReader artistsr = new StreamReader(artistws.GetResponseStream());
-
- string artistRequest = artistsr.ReadToEnd();
-
- // Grab all Track IDs listed on the API.
- string artistAlbumIdspattern = "\"url\":\"(?:.*?)\",\"id\":\"(?.*?)\"";
- string input = artistRequest;
- RegexOptions options = RegexOptions.Multiline;
-
- foreach (Match m in Regex.Matches(input, artistAlbumIdspattern, options))
- {
- string albumIdDiscog = string.Format("{0}", m.Groups["albumIds"].Value);
-
- WebRequest wr = WebRequest.Create("https://www.qobuz.com/api.json/0.2/album/get?album_id=" + albumIdDiscog + "&app_id=" + appid + "&user_auth_token=" + userAuth);
-
- // Empty output, then say Starting Downloads.
- output.Invoke(new Action(() => output.Text = String.Empty));
- output.Invoke(new Action(() => output.AppendText("FAVORITE DOWNLOADS MAY HAVE SOME ERRORS, THIS IS A NEW FEATURE, AND CURRENTLY ONLY SUPPORTS FAVORITED ALBUMS. IF YOU RUN INTO AN ISSUE, PLEASE REPORT IT ON GITHUB!\r\n")));
- output.Invoke(new Action(() => output.AppendText("Starting Downloads...\r\n\r\n")));
-
- try
- {
- // Set "loc" as the selected path.
- loc = folderBrowserDialog.SelectedPath;
-
- WebResponse ws = wr.GetResponse();
- StreamReader sr = new StreamReader(ws.GetResponseStream());
-
- string albumRequest = sr.ReadToEnd();
-
- string text = albumRequest;
-
- var tracksLog = Regex.Match(albumRequest, "tracks_count\":(?\\d+)").Groups;
- var tracks = tracksLog[1].Value;
-
- // Album Name tag
- var labelDiscogAlbumLog = Regex.Match(albumRequest, "\"title\":\"(?.*?)\",\\\"").Groups;
- var labelDiscogAlbum = labelDiscogAlbumLog[1].Value;
-
- // For converting unicode characters to ASCII
- string unicodeDiscogAlbum = labelDiscogAlbum;
- string decodedDiscogAlbum = DecodeEncodedNonAsciiCharacters(unicodeDiscogAlbum);
- labelDiscogAlbum = decodedDiscogAlbum;
-
- output.Invoke(new Action(() => output.AppendText("Downloading Album - " + labelDiscogAlbum + " ......\r\n\r\n")));
-
- #region Cover Art URL
- // Grab Cover Art URL
- var frontCoverLog = Regex.Match(albumRequest, "\"image\":{\"thumbnail\":\"(?[A-Za-z0-9:().,\\\\\\/._\\-']+)").Groups;
- var frontCover = frontCoverLog[1].Value;
-
- // Remove backslashes from the stream URL to have a proper URL.
- string imagepattern = @"(?[^\\]+)";
- string imageinput = frontCover;
- RegexOptions imageoptions = RegexOptions.Multiline;
-
- imageURLTextbox.Invoke(new Action(() => imageURLTextbox.Text = String.Empty));
-
- foreach (Match mImg in Regex.Matches(imageinput, imagepattern, imageoptions))
- {
- imageURLTextbox.Invoke(new Action(() => imageURLTextbox.AppendText(string.Format("{0}", mImg.Value))));
- }
-
- string frontCoverImg = imageURLTextbox.Text;
- string frontCoverImgBox = frontCoverImg.Replace("_50.jpg", "_150.jpg");
- frontCoverImg = frontCoverImg.Replace("_50.jpg", "_max.jpg");
-
- albumArtPicBox.Invoke(new Action(() => albumArtPicBox.ImageLocation = frontCoverImgBox));
-
- imageURLTextbox.Invoke(new Action(() => imageURLTextbox.Text = Settings.Default.savedEmail));
- #endregion
-
- #region "Goodies" URL (Digital Booklets)
- // Look for "Goodies" (digital booklet)
- var goodiesLog = Regex.Match(albumRequest, "\"goodies\":\\[{\"id\":(?.*?),\"original_url\":\"(?.*?)\",\\\"").Groups;
- var goodies = goodiesLog[2].Value;
-
- // Remove backslashes from the stream URL to have a proper URL.
- string bookpattern = @"(?[^\\]+)";
- string bookinput = goodies;
- RegexOptions bookoptions = RegexOptions.Multiline;
-
- imageURLTextbox.Invoke(new Action(() => imageURLTextbox.Text = String.Empty));
-
- foreach (Match mBook in Regex.Matches(bookinput, bookpattern, bookoptions))
- {
- imageURLTextbox.Invoke(new Action(() => imageURLTextbox.AppendText(string.Format("{0}", mBook.Value))));
- }
-
- string goodiesPDF = imageURLTextbox.Text;
-
- imageURLTextbox.Invoke(new Action(() => imageURLTextbox.Text = Settings.Default.savedEmail));
- #endregion
-
- // Grab sample rate and bit depth for album.
- var qualityLog = Regex.Match(albumRequest, "\"maximum_sampling_rate\":(?.*?),(?:.*?)\"maximum_bit_depth\":(?.*?),\"duration\"").Groups;
- var sampleRate = qualityLog[1].Value;
- var bitDepth = qualityLog[2].Value;
- var quality = "FLAC (" + bitDepth + "bit/" + sampleRate + "kHz)";
- var qualityPath = quality.Replace(@"\", "-").Replace(@"/", "-");
-
- if (formatIdString == "5")
- {
- quality = "MP3 320kbps CBR";
- qualityPath = "MP3";
- }
- else if (formatIdString == "6")
- {
- quality = "FLAC (16bit/44.1kHz)";
- qualityPath = "FLAC (16bit-44.1kHz)";
- }
- else if (formatIdString == "7")
- {
- if (quality == "FLAC (24bit/192kHz)")
- {
- quality = "FLAC (24bit/96kHz)";
- qualityPath = "FLAC (24bit-96kHz)";
- }
- }
-
- // Grab all Track IDs listed on the API.
- string trackIdspattern = "\"version\":(?:.*?),\"id\":(?.*?),";
- string trackinput = text;
- RegexOptions trackoptions = RegexOptions.Multiline;
-
-
- foreach (Match mtrack in Regex.Matches(trackinput, trackIdspattern, trackoptions))
- {
- // Set default value for max length.
- const int MaxLength = 36;
-
- //output.Invoke(new Action(() => output.AppendText(string.Format("{0}\r\n", m.Groups["trackId"].Value))));
- trackIdString = string.Format("{0}", mtrack.Groups["trackId"].Value);
-
- WebRequest trackwr = WebRequest.Create("https://www.qobuz.com/api.json/0.2/track/get?track_id=" + trackIdString + "&app_id=" + appid + "&user_auth_token=" + userAuth);
-
- WebResponse trackws = trackwr.GetResponse();
- StreamReader tracksr = new StreamReader(trackws.GetResponseStream());
-
- string trackRequest = tracksr.ReadToEnd();
-
- #region Availability Check (Valid Link?)
- // Check if available at all.
- var errorCheckLog = Regex.Match(trackRequest, "\"code\":404,\"message\":\"(?.*?)\\\"").Groups;
- var errorCheck = errorCheckLog[1].Value;
-
- if (errorCheck == "No result matching given argument")
- {
- output.Invoke(new Action(() => output.Text = String.Empty));
- output.Invoke(new Action(() => output.AppendText("ERROR: 404\r\n")));
- output.Invoke(new Action(() => output.AppendText("Error message is \"No result matching given argument\"\r\n")));
- output.Invoke(new Action(() => output.AppendText("This could mean either the link is invalid, or isn't available in the region you're downloading from (even if the account is in the correct region). If the latter is true, use a VPN for the region it's available in to download.")));
- mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = true));
- flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = true));
- flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = true));
- flacHighCheckbox.Invoke(new Action(() => flacHighCheckbox.Visible = true));
- downloadButton.Invoke(new Action(() => downloadButton.Enabled = true));
- return;
- }
- #endregion
-
- // Display album quality in quality textbox.
- qualityTextbox.Invoke(new Action(() => qualityTextbox.Text = quality));
-
- #region Get Information (Tags, Titles, etc.)
- // Track Number tag
- var trackNumberLog = Regex.Match(trackRequest, "\"track_number\":(?[0-9]+)").Groups;
- var trackNumber = trackNumberLog[1].Value;
-
- // Disc Number tag
- var discNumberLog = Regex.Match(trackRequest, "\"media_number\":(?.*?),\\\"").Groups;
- var discNumber = discNumberLog[1].Value;
-
- // Album Artist tag
- var albumArtistLog = Regex.Match(trackRequest, "\"artist\":{\"picture\":(?.*?),\"id\"(?.*?),\"albums_count\":(?.*?),\"name\":\"(?.*?)\",\\\"").Groups;
- var albumArtist = albumArtistLog[4].Value;
-
- // For converting unicode characters to ASCII
- string unicodeAlbumArtist = albumArtist;
- string decodedAlbumArtist = DecodeEncodedNonAsciiCharacters(unicodeAlbumArtist);
- albumArtist = decodedAlbumArtist;
-
- albumArtist = albumArtist.Replace("\\\"", "\"").Replace(@"\\/", @"/").Replace(@"\\", @"\").Replace(@"\/", @"/");
- var albumArtistPath = albumArtist.Replace("\\\"", "-").Replace("\"", "-").Replace(@"\", "-").Replace(@"/", "-").Replace(":", "-").Replace("<", "-").Replace(">", "-").Replace("|", "-").Replace("?", "-").Replace("*", "-");
-
- // Display album artist in text box under cover art.
- albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
-
- // If name goes over 200 characters, limit it to 200
- if (albumArtistPath.Length > MaxLength)
- {
- albumArtistPath = albumArtistPath.Substring(0, MaxLength);
- }
-
- // Track Artist tag
- var performerNameLog = Regex.Match(trackRequest, "\"performer\":{\"id\":(?.*?),\"name\":\"(?.*?)\"},\\\"").Groups;
- var performerName = performerNameLog[2].Value;
-
- // For converting unicode characters to ASCII
- string unicodePerformerName = performerName;
- string decodedPerformerName = DecodeEncodedNonAsciiCharacters(unicodePerformerName);
- performerName = decodedPerformerName;
-
- performerName = performerName.Replace("\\\"", "\"").Replace(@"\\/", @"/").Replace(@"\\", @"\").Replace(@"\/", @"/");
- var performerNamePath = performerName.Replace("\\\"", "-").Replace("\"", "-").Replace(@"\", "-").Replace(@"/", "-").Replace(":", "-").Replace("<", "-").Replace(">", "-").Replace("|", "-").Replace("?", "-").Replace("*", "-");
-
- // If name goes over 200 characters, limit it to 200
- if (performerNamePath.Length > MaxLength)
- {
- performerNamePath = performerNamePath.Substring(0, MaxLength);
- }
-
- // Track Composer tag
- var composerNameLog = Regex.Match(trackRequest, "\"composer\":{\"id\":(?.*?),\"name\":\"(?.*?)\"},\\\"").Groups;
- var composerName = composerNameLog[2].Value;
-
- // Track Explicitness
- var advisoryLog = Regex.Match(trackRequest, "\"performers\":(?:.*?)\"parental_warning\":(?.*?),").Groups;
- var advisory = advisoryLog[1].Value;
-
- // For converting unicode characters to ASCII
- string unicodeComposerName = composerName;
- string decodedComposerName = DecodeEncodedNonAsciiCharacters(unicodeComposerName);
- composerName = decodedComposerName;
-
- composerName = composerName.Replace("\\\"", "\"").Replace(@"\\/", @"/").Replace(@"\\", @"\").Replace(@"\/", @"/");
-
- // Album Name tag
- var albumNameLog = Regex.Match(trackRequest, "\"title\":\"(?.*?)\",\\\"").Groups;
- var albumName = albumNameLog[1].Value;
-
- // For converting unicode characters to ASCII
- string unicodeAlbumName = albumName;
- string decodedAlbumName = DecodeEncodedNonAsciiCharacters(unicodeAlbumName);
- albumName = decodedAlbumName;
-
- albumName = albumName.Replace("\\\"", "\"").Replace(@"\\/", @"/").Replace(@"\\", @"\").Replace(@"\/", @"/");
- var albumNamePath = albumName.Replace("\\\"", "-").Replace("\"", "-").Replace(@"\", "-").Replace(@"/", "-").Replace(":", "-").Replace("<", "-").Replace(">", "-").Replace("|", "-").Replace("?", "-").Replace("*", "-");
-
- // Display album name in text box under cover art.
- albumTextBox.Invoke(new Action(() => albumTextBox.Text = albumName));
-
- // If name goes over 200 characters, limit it to 200
- if (albumNamePath.Length > MaxLength)
- {
- albumNamePath = albumNamePath.Substring(0, MaxLength);
- }
-
- // Track Name tag
- var trackNameLog = Regex.Match(trackRequest, "\"version\":(?.*?),\"id\":(?.*?),\"maximum_bit_depth\":(?.*?),\"title\":\"(?.*?)\",\\\"").Groups;
- var trackName = trackNameLog[4].Value;
- trackName = trackName.Trim(); // Remove spaces from end of track name
-
- // For converting unicode characters to ASCII
- string unicodeTrackName = trackName;
- string decodedTrackName = DecodeEncodedNonAsciiCharacters(unicodeTrackName);
- trackName = decodedTrackName;
-
- trackName = trackName.Replace("\\\"", "\"").Replace(@"\\/", @"/").Replace(@"\\", @"\").Replace(@"\/", @"/");
- var trackNamePath = trackName.Replace("\\\"", "-").Replace("\"", "-").Replace(@"\", "-").Replace(@"/", "-").Replace(":", "-").Replace("<", "-").Replace(">", "-").Replace("|", "-").Replace("?", "-").Replace("*", "-");
-
- // If name goes over 200 characters, limit it to 200
- if (trackNamePath.Length > MaxLength)
- {
- trackNamePath = trackNamePath.Substring(0, MaxLength);
- }
-
- // Version Name tag
- var versionNameLog = Regex.Match(trackRequest, "\"version\":\"(?.*?)\",\\\"").Groups;
- var versionName = versionNameLog[1].Value;
-
- // For converting unicode characters to ASCII
- string unicodeVersionName = versionName;
- string decodedVersionName = DecodeEncodedNonAsciiCharacters(unicodeVersionName);
- versionName = decodedVersionName;
-
- versionName = versionName.Replace("\\\"", "\"").Replace(@"\\/", @"/").Replace(@"\\", @"\").Replace(@"\/", @"/");
- var versionNamePath = versionName.Replace("\\\"", "-").Replace("\"", "-").Replace(@"\", "-").Replace(@"/", "-").Replace(":", "-").Replace("<", "-").Replace(">", "-").Replace("|", "-").Replace("?", "-").Replace("*", "-");
-
- // Genre tag
- var genreLog = Regex.Match(trackRequest, "\"genre\":{\"id\":(?.*?),\"color\":\"(?.*?)\",\"name\":\"(?.*?)\",\\\"").Groups;
- var genre = genreLog[3].Value;
-
- // For converting unicode characters to ASCII
- string unicodeGenre = genre;
- string decodedGenre = DecodeEncodedNonAsciiCharacters(unicodeGenre);
- genre = decodedGenre.Replace("\\\"", "\"").Replace(@"\\/", @"/").Replace(@"\\", @"\").Replace(@"\/", @"/");
-
- // Release Date tag, grabs the available "stream" date
- var releaseDateLog = Regex.Match(trackRequest, "\"release_date_stream\":\"(?.*?)\",\\\"").Groups;
- var releaseDate = releaseDateLog[1].Value;
-
- // Display release date in text box under cover art.
- releaseDateTextBox.Invoke(new Action(() => releaseDateTextBox.Text = releaseDate));
-
- // Copyright tag
- var copyrightLog = Regex.Match(trackRequest, "\"copyright\":\"(?.*?)\"copyright\":\"(?.*?)\\\"").Groups;
- var copyright = copyrightLog[2].Value;
-
- // For converting unicode characters to ASCII
- string unicodeCopyright = copyright;
- string decodedCopyright = DecodeEncodedNonAsciiCharacters(unicodeCopyright);
- copyright = decodedCopyright;
-
- copyright = copyright.Replace("\\\"", "\"").Replace(@"\\/", @"/").Replace(@"\\", @"\").Replace(@"\/", @"/").Replace(@"\u2117", @"℗");
-
- // UPC tag
- var upcLog = Regex.Match(trackRequest, "\"upc\":\"(?.*?)\",\\\"").Groups;
- var upc = upcLog[1].Value;
-
- // Display UPC in text box under cover art.
- upcTextBox.Invoke(new Action(() => upcTextBox.Text = upc));
-
- // ISRC tag
- var isrcLog = Regex.Match(trackRequest, "\"isrc\":\"(?.*?)\",\\\"").Groups;
- var isrc = isrcLog[1].Value;
-
- // Total Tracks tag
- var trackTotalLog = Regex.Match(trackRequest, "\"tracks_count\":(?[0-9]+)").Groups;
- var trackTotal = trackTotalLog[1].Value;
-
- // Display Total Tracks in text box under cover art.
- totalTracksTextbox.Invoke(new Action(() => totalTracksTextbox.Text = trackTotal));
-
- // Total Discs tag
- var discTotalLog = Regex.Match(trackRequest, "\"media_count\":(?[0-9]+)").Groups;
- var discTotal = discTotalLog[1].Value;
- #endregion
-
- #region Filename Number Padding
- // Set default track number padding length
- var paddingLength = 2;
-
- // Prepare track number padding in filename.
- string paddingLog = trackTotal.Length.ToString();
- if (paddingLog == "1")
- {
- paddingLength = 2;
- }
- else
- {
- paddingLength = trackTotal.Length;
- }
-
- // Set default disc number padding length
- var paddingDiscLength = 2;
-
- // Prepare disc number padding in filename.
- string paddingDiscLog = discTotal.Length.ToString();
- if (paddingDiscLog == "1")
- {
- paddingDiscLength = 1;
- }
- else
- {
- paddingDiscLength = discTotal.Length;
- }
- #endregion
-
- #region Create Directories
- // Create strings for disc folders
- string discFolder = null;
- string discFolderCreate = null;
-
- // If more than 1 disc, create folders for discs. Otherwise, strings will remain null.
- if (discTotal != "1")
- {
- discFolder = "CD " + discNumber.PadLeft(paddingDiscLength, '0') + "\\";
- discFolderCreate = "\\CD " + discNumber.PadLeft(paddingDiscLength, '0') + "\\";
- }
-
- System.IO.Directory.CreateDirectory(loc + "\\" + "- Favorites" + "\\" + albumArtistPath);
- System.IO.Directory.CreateDirectory(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]");
- System.IO.Directory.CreateDirectory(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath);
- System.IO.Directory.CreateDirectory(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + discFolderCreate);
-
- string discogPath = loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + discFolderCreate;
- #endregion
-
- #region Availability Check (Streamable?)
- // Check if available for streaming.
- var streamCheckLog = Regex.Match(trackRequest, "\"track_number\":(?.*?)\"streamable\":(?.*?),\"").Groups;
- var streamCheck = streamCheckLog[2].Value;
-
- if (streamCheck != "true")
- {
- if (streamableCheckbox.Checked == true)
- {
- output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n")));
- System.Threading.Thread.Sleep(800);
- continue;
- }
- else
- {
- output.Invoke(new Action(() => output.AppendText("\r\nTrack " + trackNumber + " \"" + trackName + "\" is not available for streaming. But stremable check is being ignored for debugging, or messed up releases. Attempting to download...\r\n")));
- }
- }
- #endregion
-
- #region Check if File Exists
- // Check if there is a version name.
- if (versionName == null | versionName == "")
- {
- if (System.IO.File.Exists(discogPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType))
- {
- output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
- continue;
- }
- }
- else
- {
- if (System.IO.File.Exists(discogPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType))
- {
- output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + " (" + versionName + ")" + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
- continue;
- }
- }
- #endregion
-
- // Close web request and create streaming URL.
- trackwr.Abort();
- createURL(sender, e);
-
- try
- {
- #region Downloading
- // Check if there is a version name.
- if (versionName == null | versionName == "")
- {
- output.Invoke(new Action(() => output.AppendText("Downloading - " + trackNumber.PadLeft(paddingLength, '0') + " - " + trackName + " ......")));
- }
- else
- {
- output.Invoke(new Action(() => output.AppendText("Downloading - " + trackNumber.PadLeft(paddingLength, '0') + " - " + trackName + " (" + versionName + ")" + " ......")));
- }
- // Being download process.
- var client = new HttpClient();
- // Run through TLS to allow secure connection.
- ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
- // Set "range" header to nearly unlimited.
- client.DefaultRequestHeaders.Range = new RangeHeaderValue(0, 999999999999);
- // Set user-agent to Firefox.
- client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0");
- // Set referer URL to album ID.
- client.DefaultRequestHeaders.Add("Referer", "https://play.qobuz.com/album/" + albumIdDiscog);
- // Download the URL in the "Streamed URL" Textbox (Will most likely be replaced).
- using (var stream = await client.GetStreamAsync(testURLBox.Text))
-
- // Save single track in selected path.
- if (versionNamePath == null | versionNamePath == "")
- {
- // If there is NOT a version name.
- using (var output = System.IO.File.Create(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + discFolder + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType))
- {
- await stream.CopyToAsync(output);
- }
- }
- else
- {
- // If there is a version name.
- using (var output = System.IO.File.Create(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + discFolder + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType))
- {
- await stream.CopyToAsync(output);
- }
- }
- #endregion
-
- #region Cover Art Saving
- if (System.IO.File.Exists(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg"))
- {
- // Skip, don't re-download.
- }
- else
- {
- if (imageCheckbox.Checked == true)
- {
- // Save cover art to selected path (Currently happens every time a track is downloaded).
- using (WebClient imgClient = new WebClient())
- {
- // Download max quality Cover Art to "Cover.jpg" file in chosen path.
- imgClient.DownloadFile(new Uri(frontCoverImg), loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
- }
- }
- }
- #endregion
-
- #region Tagging
- // Check if audio file type is FLAC or MP3
- if (audioFileType == ".mp3")
- {
- #region MP3 Tagging (Needs Work)
- // Select the downloaded file to prepare for tagging.
- // Check if there's a version name or not
- if (versionName == null | versionName == "")
- {
- // If there is NOT a version name.
- var tfile = TagLib.File.Create(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + discFolder + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType);
- // For custom / troublesome tags.
- TagLib.Id3v2.Tag t = (TagLib.Id3v2.Tag)tfile.GetTag(TagLib.TagTypes.Id3v2);
-
-
- // Saving cover art to file(s)
- if (imageCheckbox.Checked == true)
- {
- // Define cover art to use for MP3 file(s)
- TagLib.Id3v2.AttachedPictureFrame pic = new TagLib.Id3v2.AttachedPictureFrame();
- pic.TextEncoding = TagLib.StringType.Latin1;
- pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
- pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
-
- // Save cover art to MP3 file.
- tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
- tfile.Save();
- }
-
- // Track Title tag
- if (trackTitleCheckbox.Checked == true)
- {
- tfile.Tag.Title = trackName;
- }
-
- // Album Title tag
- if (albumCheckbox.Checked == true)
- {
- tfile.Tag.Album = albumName;
- }
-
- // Album Artits tag
- if (albumArtistCheckbox.Checked == true)
- {
- tfile.Tag.AlbumArtists = new string[] { albumArtist };
- }
-
- // Track Artist tag
- if (artistCheckbox.Checked == true)
- {
- tfile.Tag.Performers = new string[] { performerName };
- }
-
- // Composer tag
- if (composerCheckbox.Checked == true)
- {
- tfile.Tag.Composers = new string[] { composerName };
- }
-
- // Release Date tag
- if (releaseCheckbox.Checked == true)
- {
- releaseDate = releaseDate.Substring(0, 4);
- tfile.Tag.Year = UInt32.Parse(releaseDate);
- }
-
- // Genre tag
- if (genreCheckbox.Checked == true)
- {
- tfile.Tag.Genres = new string[] { genre };
- }
-
- // Track Number tag
- if (trackNumberCheckbox.Checked == true)
- {
- tfile.Tag.Track = UInt32.Parse(trackNumber);
- }
-
- // Disc Number tag
- if (discNumberCheckbox.Checked == true)
- {
- tfile.Tag.Disc = UInt32.Parse(discNumber);
- }
-
- // Total Discs tag
- if (discTotalCheckbox.Checked == true)
- {
- tfile.Tag.DiscCount = UInt32.Parse(discTotal);
- }
-
- // Total Tracks tag
- if (trackTotalCheckbox.Checked == true)
- {
- tfile.Tag.TrackCount = UInt32.Parse(trackTotal);
- }
-
- // Comment tag
- if (commentCheckbox.Checked == true)
- {
- tfile.Tag.Comment = commentTextbox.Text;
- }
-
- // Copyright tag
- if (copyrightCheckbox.Checked == true)
- {
- tfile.Tag.Copyright = copyright;
- }
- // UPC tag
- if (upcCheckbox.Checked == true)
- {
- // Not available on MP3 at the moment
- }
-
- // ISRC tag
- if (isrcCheckbox.Checked == true)
- {
- TagLib.Id3v2.Tag tag = (TagLib.Id3v2.Tag)tfile.GetTag(TagTypes.Id3v2, true);
- tag.SetTextFrame("TSRC", isrc);
- }
-
- // Explicit tag
- if (explicitCheckbox.Checked == true)
- {
- // Not available on MP3 at the moment
- }
-
- // Save all selected tags to file
- tfile.Save();
- }
- else
- {
- // If there is a version name.
- var tfile = TagLib.File.Create(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + discFolder + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType);
- // For custom / troublesome tags.
- TagLib.Id3v2.Tag t = (TagLib.Id3v2.Tag)tfile.GetTag(TagLib.TagTypes.Id3v2);
-
-
- // Saving cover art to file(s)
- if (imageCheckbox.Checked == true)
- {
- // Define cover art to use for FLAC file(s)
- TagLib.Id3v2.AttachedPictureFrame pic = new TagLib.Id3v2.AttachedPictureFrame();
- pic.TextEncoding = TagLib.StringType.Latin1;
- pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
- pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
-
- // Save cover art to FLAC file.
- tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
- tfile.Save();
- }
-
- // Track Title tag
- if (trackTitleCheckbox.Checked == true)
- {
- tfile.Tag.Title = trackName + " (" + versionName + ")";
- }
-
- // Album Title tag
- if (albumCheckbox.Checked == true)
- {
- tfile.Tag.Album = albumName;
- }
-
- // Album Artits tag
- if (albumArtistCheckbox.Checked == true)
- {
- tfile.Tag.AlbumArtists = new string[] { albumArtist };
- }
-
- // Track Artist tag
- if (artistCheckbox.Checked == true)
- {
- tfile.Tag.Performers = new string[] { performerName };
- }
-
- // Composer tag
- if (composerCheckbox.Checked == true)
- {
- tfile.Tag.Composers = new string[] { composerName };
- }
-
- // Release Date tag
- if (releaseCheckbox.Checked == true)
- {
- releaseDate = releaseDate.Substring(0, 4);
- tfile.Tag.Year = UInt32.Parse(releaseDate);
- }
-
- // Genre tag
- if (genreCheckbox.Checked == true)
- {
- tfile.Tag.Genres = new string[] { genre };
- }
-
- // Track Number tag
- if (trackNumberCheckbox.Checked == true)
- {
- tfile.Tag.Track = UInt32.Parse(trackNumber);
- }
-
- // Disc Number tag
- if (discNumberCheckbox.Checked == true)
- {
- tfile.Tag.Disc = UInt32.Parse(discNumber);
- }
-
- // Total Discs tag
- if (discTotalCheckbox.Checked == true)
- {
- tfile.Tag.DiscCount = UInt32.Parse(discTotal);
- }
-
- // Total Tracks tag
- if (trackTotalCheckbox.Checked == true)
- {
- tfile.Tag.TrackCount = UInt32.Parse(trackTotal);
- }
-
- // Comment tag
- if (commentCheckbox.Checked == true)
- {
- tfile.Tag.Comment = commentTextbox.Text;
- }
-
- // Copyright tag
- if (copyrightCheckbox.Checked == true)
- {
- tfile.Tag.Copyright = copyright;
- }
- // UPC tag
- if (upcCheckbox.Checked == true)
- {
- // Not available on MP3 at the moment
- }
-
- // ISRC tag
- if (isrcCheckbox.Checked == true)
- {
- TagLib.Id3v2.Tag tag = (TagLib.Id3v2.Tag)tfile.GetTag(TagTypes.Id3v2, true);
- tag.SetTextFrame("TSRC", isrc);
- }
-
- // Explicit tag
- if (explicitCheckbox.Checked == true)
- {
- // Not available on MP3 at the moment
- }
-
- // Save all selected tags to file
- tfile.Save();
- }
- #endregion
- }
- else
- {
- #region FLAC Tagging
- // Select the downloaded file to prepare for tagging.
- // Check if there's a version name or not
- if (versionName == null | versionName == "")
- {
- // If there is NOT a version name.
- var tfile = TagLib.File.Create(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + discFolder + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType);
- // For custom / troublesome tags.
- var custom = (TagLib.Ogg.XiphComment)tfile.GetTag(TagLib.TagTypes.Xiph);
-
-
- // Saving cover art to file(s)
- if (imageCheckbox.Checked == true)
- {
- // Define cover art to use for FLAC file(s)
- TagLib.Id3v2.AttachedPictureFrame pic = new TagLib.Id3v2.AttachedPictureFrame();
- pic.TextEncoding = TagLib.StringType.Latin1;
- pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
- pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
-
- // Save cover art to FLAC file.
- tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
- tfile.Save();
- }
-
- // Track Title tag
- if (trackTitleCheckbox.Checked == true)
- {
- tfile.Tag.Title = trackName;
- }
-
- // Album Title tag
- if (albumCheckbox.Checked == true)
- {
- tfile.Tag.Album = albumName;
- }
-
- // Album Artits tag
- if (albumArtistCheckbox.Checked == true)
- {
- custom.SetField("ALBUMARTIST", new string[] { albumArtist });
- }
-
- // Track Artist tag
- if (artistCheckbox.Checked == true)
- {
- custom.SetField("ARTIST", new string[] { performerName });
- }
-
- // Composer tag
- if (composerCheckbox.Checked == true)
- {
- custom.SetField("COMPOSER", new string[] { composerName });
- }
-
- // Release Date tag
- if (releaseCheckbox.Checked == true)
- {
- custom.SetField("YEAR", new string[] { releaseDate });
- }
-
- // Genre tag
- if (genreCheckbox.Checked == true)
- {
- custom.SetField("GENRE", new string[] { genre });
- }
-
- // Track Number tag
- if (trackNumberCheckbox.Checked == true)
- {
- tfile.Tag.Track = UInt32.Parse(trackNumber);
- }
-
- // Disc Number tag
- if (discNumberCheckbox.Checked == true)
- {
- tfile.Tag.Disc = UInt32.Parse(discNumber);
- }
-
- // Total Discs tag
- if (discTotalCheckbox.Checked == true)
- {
- tfile.Tag.DiscCount = UInt32.Parse(discTotal);
- }
-
- // Total Tracks tag
- if (trackTotalCheckbox.Checked == true)
- {
- tfile.Tag.TrackCount = UInt32.Parse(trackTotal);
- }
-
- // Comment tag
- if (commentCheckbox.Checked == true)
- {
- custom.SetField("COMMENT", new string[] { commentTextbox.Text });
- }
-
- // Copyright tag
- if (copyrightCheckbox.Checked == true)
- {
- custom.SetField("COPYRIGHT", new string[] { copyright });
- }
- // UPC tag
- if (upcCheckbox.Checked == true)
- {
- custom.SetField("UPC", new string[] { upc });
- }
-
- // ISRC tag
- if (isrcCheckbox.Checked == true)
- {
- custom.SetField("ISRC", new string[] { isrc });
- }
-
- // Explicit tag
- if (explicitCheckbox.Checked == true)
- {
- if (advisory == "false") { custom.SetField("ITUNESADVISORY", new string[] { "0" }); } else { custom.SetField("ITUNESADVISORY", new string[] { "1" }); }
- }
-
- // Save all selected tags to file
- tfile.Save();
- }
- else
- {
- // If there is a version name.
- var tfile = TagLib.File.Create(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + discFolder + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType);
- // For custom / troublesome tags.
- var custom = (TagLib.Ogg.XiphComment)tfile.GetTag(TagLib.TagTypes.Xiph);
-
-
- // Saving cover art to file(s)
- if (imageCheckbox.Checked == true)
- {
- // Define cover art to use for FLAC file(s)
- TagLib.Id3v2.AttachedPictureFrame pic = new TagLib.Id3v2.AttachedPictureFrame();
- pic.TextEncoding = TagLib.StringType.Latin1;
- pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
- pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Cover.jpg");
-
- // Save cover art to FLAC file.
- tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
- tfile.Save();
- }
-
- // Track Title tag
- if (trackTitleCheckbox.Checked == true)
- {
- tfile.Tag.Title = trackName + " (" + versionName + ")";
- }
-
- // Album Title tag
- if (albumCheckbox.Checked == true)
- {
- tfile.Tag.Album = albumName;
- }
-
- // Album Artits tag
- if (albumArtistCheckbox.Checked == true)
- {
- custom.SetField("ALBUMARTIST", new string[] { albumArtist });
- }
-
- // Track Artist tag
- if (artistCheckbox.Checked == true)
- {
- custom.SetField("ARTIST", new string[] { performerName });
- }
-
- // Composer tag
- if (composerCheckbox.Checked == true)
- {
- custom.SetField("COMPOSER", new string[] { composerName });
- }
-
- // Release Date tag
- if (releaseCheckbox.Checked == true)
- {
- custom.SetField("YEAR", new string[] { releaseDate });
- }
-
- // Genre tag
- if (genreCheckbox.Checked == true)
- {
- custom.SetField("GENRE", new string[] { genre });
- }
-
- // Track Number tag
- if (trackNumberCheckbox.Checked == true)
- {
- tfile.Tag.Track = UInt32.Parse(trackNumber);
- }
-
- // Disc Number tag
- if (discNumberCheckbox.Checked == true)
- {
- tfile.Tag.Disc = UInt32.Parse(discNumber);
- }
-
- // Total Discs tag
- if (discTotalCheckbox.Checked == true)
- {
- tfile.Tag.DiscCount = UInt32.Parse(discTotal);
- }
-
- // Total Tracks tag
- if (trackTotalCheckbox.Checked == true)
- {
- tfile.Tag.TrackCount = UInt32.Parse(trackTotal);
- }
-
- // Comment tag
- if (commentCheckbox.Checked == true)
- {
- custom.SetField("COMMENT", new string[] { commentTextbox.Text });
- }
-
- // Copyright tag
- if (copyrightCheckbox.Checked == true)
- {
- custom.SetField("COPYRIGHT", new string[] { copyright });
- }
- // UPC tag
- if (upcCheckbox.Checked == true)
- {
- custom.SetField("UPC", new string[] { upc });
- }
-
- // ISRC tag
- if (isrcCheckbox.Checked == true)
- {
- custom.SetField("ISRC", new string[] { isrc });
- }
-
- // Explicit tag
- if (explicitCheckbox.Checked == true)
- {
- if (advisory == "false") { custom.SetField("ITUNESADVISORY", new string[] { "0" }); } else { custom.SetField("ITUNESADVISORY", new string[] { "1" }); }
- }
-
- // Save all selected tags to file
- tfile.Save();
- }
- #endregion
- }
- #endregion
-
- #region Digital Booklet
- // If a booklet was found, save it.
- if (goodiesPDF == null | goodiesPDF == "")
- {
- // No need to download something that doesn't exist.
- }
- else
- {
- if (System.IO.File.Exists(loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Digital Booklet.pdf"))
- {
- // Skip, don't re-download.
- }
- else
- {
- // Save digital booklet to selected path
- output.Invoke(new Action(() => output.AppendText("\r\nGoodies found, downloading...")));
- using (WebClient bookClient = new WebClient())
- {
- // Download max quality Cover Art to "Cover.jpg" file in chosen path.
- bookClient.DownloadFile(new Uri(goodiesPDF), loc + "\\" + "- Favorites" + "\\" + albumArtistPath + "\\" + albumNamePath + " [" + albumIdDiscog + "]" + "\\" + qualityPath + "\\" + "Digital Booklet.pdf");
- }
- }
- }
- #endregion
- }
- catch (Exception downloadError)
- {
- // If there is an issue trying to, or during the download, show error info.
- string error = downloadError.ToString();
- output.Invoke(new Action(() => output.AppendText("\r\n\r\n")));
- output.Invoke(new Action(() => output.AppendText("Track Download ERROR. Information below.\r\n\r\n")));
- output.Invoke(new Action(() => output.AppendText(error)));
- output.Invoke(new Action(() => output.AppendText("\r\n\r\nIf some tracks aren't available for streaming on the album you're trying to download, try to manually download the available tracks individually.")));
- mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = true));
- flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = true));
- flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = true));
- flacHighCheckbox.Invoke(new Action(() => flacHighCheckbox.Visible = true));
- downloadButton.Invoke(new Action(() => downloadButton.Enabled = true));
- return;
- }
-
- // Say when a track is done downloading, then wait for the next track / end.
- output.Invoke(new Action(() => output.AppendText("Track Download Done!\r\n")));
- System.Threading.Thread.Sleep(800);
- }
-
- // Say that downloading is completed.
- output.Invoke(new Action(() => output.AppendText("\r\n\r\n")));
- output.Invoke(new Action(() => output.AppendText("Downloading job completed! All downloaded files will be located in your chosen path.")));
- mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = true));
- flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = true));
- flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = true));
- flacHighCheckbox.Invoke(new Action(() => flacHighCheckbox.Visible = true));
- downloadButton.Invoke(new Action(() => downloadButton.Enabled = true));
- }
- catch (Exception ex)
- {
- string error = ex.ToString();
- output.Invoke(new Action(() => output.Text = String.Empty));
- output.Invoke(new Action(() => output.AppendText("Failed to download (First Phase). Error information below.\r\n\r\n")));
- output.Invoke(new Action(() => output.AppendText(error)));
- mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = true));
- flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = true));
- flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = true));
- flacHighCheckbox.Invoke(new Action(() => flacHighCheckbox.Visible = true));
- downloadButton.Invoke(new Action(() => downloadButton.Enabled = true));
- return;
- }
- }
- }
- catch (Exception downloadError)
- {
- // If there is an issue trying to, or during the download, show error info.
- string error = downloadError.ToString();
- output.Invoke(new Action(() => output.Text = String.Empty));
- output.Invoke(new Action(() => output.AppendText("Label Download ERROR. Information below.\r\n\r\n")));
- output.Invoke(new Action(() => output.AppendText(error)));
- mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = true));
- flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = true));
- flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = true));
- flacHighCheckbox.Invoke(new Action(() => flacHighCheckbox.Visible = true));
- downloadButton.Invoke(new Action(() => downloadButton.Enabled = true));
- return;
- }
- #endregion
+
}
#endregion
@@ -5242,7 +4222,7 @@ namespace QobuzDownloaderX
if (streamableCheckbox.Checked == true)
{
output.Invoke(new Action(() => output.AppendText("Track " + trackNumber + " \"" + trackName + "\" is not available for streaming. Skipping track...\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
else
@@ -5259,7 +4239,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(albumPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
}
@@ -5268,7 +4248,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(albumPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + " (" + versionName + ")" + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
continue;
}
}
@@ -5327,6 +4307,13 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg"))
{
// Skip, don't re-download.
+
+ // Save cover art to selected path (Currently happens every time a track is downloaded).
+ using (WebClient imgClient = new WebClient())
+ {
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
}
else
{
@@ -5335,6 +4322,9 @@ namespace QobuzDownloaderX
{
// Download max quality Cover Art to "Cover.jpg" file in chosen path.
imgClient.DownloadFile(new Uri(frontCoverImg), loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
}
}
#endregion
@@ -5362,7 +4352,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to MP3 file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -5485,7 +4475,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -5615,7 +4605,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -5736,7 +4726,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -5892,9 +4882,15 @@ namespace QobuzDownloaderX
return;
}
+ // Delete image file used for tagging
+ if (System.IO.File.Exists(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg"))
+ {
+ System.IO.File.Delete(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
+
// Say when a track is done downloading, then wait for the next track / end.
output.Invoke(new Action(() => output.AppendText("Track Download Done!\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
}
// Say that downloading is completed.
@@ -6250,7 +5246,7 @@ namespace QobuzDownloaderX
if (streamableCheckbox.Checked == true)
{
output.Invoke(new Action(() => output.AppendText("Track is not available for streaming. Unable to download.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = true));
flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = true));
flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = true));
@@ -6272,7 +5268,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(trackPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = true));
flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = true));
flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = true));
@@ -6286,7 +5282,7 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(trackPath + "\\" + trackNumber.PadLeft(paddingLength, '0') + " " + trackNamePath.Trim() + " (" + versionNamePath + ")" + audioFileType))
{
output.Invoke(new Action(() => output.AppendText("File for \"" + trackNumber.PadLeft(paddingLength, '0') + " " + trackName + " (" + versionName + ")" + "\" already exists. Skipping.\r\n")));
- System.Threading.Thread.Sleep(800);
+ System.Threading.Thread.Sleep(400);
mp3Checkbox.Invoke(new Action(() => mp3Checkbox.Visible = true));
flacLowCheckbox.Invoke(new Action(() => flacLowCheckbox.Visible = true));
flacMidCheckbox.Invoke(new Action(() => flacMidCheckbox.Visible = true));
@@ -6350,14 +5346,23 @@ namespace QobuzDownloaderX
if (System.IO.File.Exists(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg"))
{
// Skip, don't re-download.
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ using (WebClient imgClient = new WebClient())
+ {
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
}
else
{
- // Save cover art to selected path (Currently happens every time a track is downloaded).
+ // Save cover art to selected path.
using (WebClient imgClient = new WebClient())
{
// Download max quality Cover Art to "Cover.jpg" file in chosen path.
imgClient.DownloadFile(new Uri(frontCoverImg), loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+
+ // Download selected cover art size for tagging files (Currently happens every time a track is downloaded).
+ imgClient.DownloadFile(new Uri(frontCoverImg.Replace("_max", "_" + artSize)), loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
}
}
#endregion
@@ -6385,7 +5390,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to MP3 file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -6508,7 +5513,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -6638,7 +5643,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -6759,7 +5764,7 @@ namespace QobuzDownloaderX
pic.TextEncoding = TagLib.StringType.Latin1;
pic.MimeType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
pic.Type = TagLib.PictureType.FrontCover;
- pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + "Cover.jpg");
+ pic.Data = TagLib.ByteVector.FromPath(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
// Save cover art to FLAC file.
tfile.Tag.Pictures = new TagLib.IPicture[1] { pic };
@@ -6883,6 +5888,12 @@ namespace QobuzDownloaderX
return;
}
+ // Delete image file used for tagging
+ if (System.IO.File.Exists(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg"))
+ {
+ System.IO.File.Delete(loc + "\\" + albumArtistPath + "\\" + albumNamePath + "\\" + qualityPath + "\\" + artSize + ".jpg");
+ }
+
// Say that downloading is completed.
output.Invoke(new Action(() => output.AppendText("Track Download Done!\r\n\r\n")));
output.Invoke(new Action(() => output.AppendText("File will be located in your selected path.")));
@@ -7220,5 +6231,13 @@ namespace QobuzDownloaderX
Process.Start("QobuzDownloaderX.exe");
Application.Exit();
}
+
+ private void artSizeSelect_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ // Set artSize to selected value, and save selected option to settings.
+ artSize = artSizeSelect.Text;
+ Settings.Default.savedArtSize = artSizeSelect.SelectedIndex;
+ Settings.Default.Save();
+ }
}
}
diff --git a/QobuzDownloaderX/Properties/AssemblyInfo.cs b/QobuzDownloaderX/Properties/AssemblyInfo.cs
index dc34282..f791c16 100644
--- a/QobuzDownloaderX/Properties/AssemblyInfo.cs
+++ b/QobuzDownloaderX/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.9.9.12")]
-[assembly: AssemblyFileVersion("0.9.9.12")]
+[assembly: AssemblyVersion("0.9.9.13")]
+[assembly: AssemblyFileVersion("0.9.9.13")]
diff --git a/QobuzDownloaderX/Properties/Settings.Designer.cs b/QobuzDownloaderX/Properties/Settings.Designer.cs
index 2a37d51..23dd201 100644
--- a/QobuzDownloaderX/Properties/Settings.Designer.cs
+++ b/QobuzDownloaderX/Properties/Settings.Designer.cs
@@ -418,5 +418,17 @@ namespace QobuzDownloaderX.Properties {
this["savedAltLoginValue"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("1")]
+ public int savedArtSize {
+ get {
+ return ((int)(this["savedArtSize"]));
+ }
+ set {
+ this["savedArtSize"] = value;
+ }
+ }
}
}
diff --git a/QobuzDownloaderX/Properties/Settings.settings b/QobuzDownloaderX/Properties/Settings.settings
index f0366b5..67fb6c7 100644
--- a/QobuzDownloaderX/Properties/Settings.settings
+++ b/QobuzDownloaderX/Properties/Settings.settings
@@ -101,5 +101,8 @@
0
+
+ 1
+
\ No newline at end of file