5 Commits

Author SHA1 Message Date
AiiR
e548bfe90b 0.9.9.21
- Added another debug option for Re-enabling disabled buttons and checkboxes, for if anything goes wrong and they don't get re-enabled automatically.
- Added a Hide button in debug options
- Added a way for users to change the max length for filenames. There's a limit at 110 to avoid errors. If you still get errors with 110, just lower the value to download, but still create an issue with the error, and provide a link to the release, so I can check what a new limit should be.
- Added a line of code before grabbing tags to set composer to `null`, as sometimes QBDLX would keep the old value from another release and use it for another.
2020-08-15 00:43:54 -04:00
AiiR
bcc81b8462 0.9.9.20
- Fixed login
2020-08-10 15:25:26 -04:00
AiiR
ba8b9e3eec 0.9.9.19
0.9.9.19
2020-07-24 21:12:12 -04:00
AiiR
1ead0ed343 Track IDs regex
Changed regex for track IDs
2020-07-22 21:03:41 -04:00
AiiR
3962e0f682 0.9.9.18
0.9.9.18
2020-07-20 17:17:03 -04:00
7 changed files with 288 additions and 55 deletions

View File

@@ -115,6 +115,9 @@
<setting name="typeTag" serializeAs="String">
<value>True</value>
</setting>
<setting name="savedMaxLength" serializeAs="String">
<value>36</value>
</setting>
</QobuzDownloaderX.Properties.Settings>
</userSettings>
</configuration>

View File

@@ -107,6 +107,12 @@
this.artSizeLabel = new System.Windows.Forms.Label();
this.typeCheckbox = new System.Windows.Forms.CheckBox();
this.aboutLabel = new System.Windows.Forms.Label();
this.enableBtnsButton = new System.Windows.Forms.Button();
this.hideDebugButton = new System.Windows.Forms.Button();
this.maxLengthLabel = new System.Windows.Forms.Label();
this.panel9 = new System.Windows.Forms.Panel();
this.maxLengthTextbox = new System.Windows.Forms.TextBox();
this.maxLengthWarnLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.albumArtPicBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.logoBox)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.profilePictureBox)).BeginInit();
@@ -755,7 +761,7 @@
//
this.mp3WarnLabel.AutoSize = true;
this.mp3WarnLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102)))));
this.mp3WarnLabel.Location = new System.Drawing.Point(744, 711);
this.mp3WarnLabel.Location = new System.Drawing.Point(744, 697);
this.mp3WarnLabel.Name = "mp3WarnLabel";
this.mp3WarnLabel.Size = new System.Drawing.Size(182, 13);
this.mp3WarnLabel.TabIndex = 85;
@@ -863,7 +869,7 @@
this.streamableCheckbox.Checked = true;
this.streamableCheckbox.CheckState = System.Windows.Forms.CheckState.Checked;
this.streamableCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102)))));
this.streamableCheckbox.Location = new System.Drawing.Point(243, 12);
this.streamableCheckbox.Location = new System.Drawing.Point(243, 41);
this.streamableCheckbox.Name = "streamableCheckbox";
this.streamableCheckbox.Size = new System.Drawing.Size(113, 17);
this.streamableCheckbox.TabIndex = 91;
@@ -876,13 +882,14 @@
this.secretTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.secretTextbox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.secretTextbox.ForeColor = System.Drawing.Color.White;
this.secretTextbox.Location = new System.Drawing.Point(352, 35);
this.secretTextbox.Location = new System.Drawing.Point(412, 15);
this.secretTextbox.Multiline = true;
this.secretTextbox.Name = "secretTextbox";
this.secretTextbox.ReadOnly = true;
this.secretTextbox.Size = new System.Drawing.Size(209, 20);
this.secretTextbox.Size = new System.Drawing.Size(179, 20);
this.secretTextbox.TabIndex = 92;
this.secretTextbox.Visible = false;
this.secretTextbox.WordWrap = false;
//
// displaySecretButton
//
@@ -890,7 +897,7 @@
this.displaySecretButton.FlatAppearance.BorderSize = 0;
this.displaySecretButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.displaySecretButton.ForeColor = System.Drawing.Color.White;
this.displaySecretButton.Location = new System.Drawing.Point(243, 32);
this.displaySecretButton.Location = new System.Drawing.Point(303, 12);
this.displaySecretButton.Name = "displaySecretButton";
this.displaySecretButton.Size = new System.Drawing.Size(103, 23);
this.displaySecretButton.TabIndex = 93;
@@ -927,9 +934,9 @@
// hiddenTextPanel
//
this.hiddenTextPanel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102)))));
this.hiddenTextPanel.Location = new System.Drawing.Point(352, 55);
this.hiddenTextPanel.Location = new System.Drawing.Point(412, 36);
this.hiddenTextPanel.Name = "hiddenTextPanel";
this.hiddenTextPanel.Size = new System.Drawing.Size(209, 1);
this.hiddenTextPanel.Size = new System.Drawing.Size(179, 1);
this.hiddenTextPanel.TabIndex = 87;
this.hiddenTextPanel.Visible = false;
//
@@ -954,7 +961,7 @@
"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.Size = new System.Drawing.Size(87, 21);
this.artSizeSelect.TabIndex = 96;
this.artSizeSelect.SelectedIndexChanged += new System.EventHandler(this.artSizeSelect_SelectedIndexChanged);
//
@@ -964,9 +971,9 @@
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.Size = new System.Drawing.Size(210, 13);
this.artSizeLabel.TabIndex = 97;
this.artSizeLabel.Text = "Embedded Art Size: px";
this.artSizeLabel.Text = "Embedded Art Size: px";
//
// typeCheckbox
//
@@ -975,7 +982,7 @@
this.typeCheckbox.CheckState = System.Windows.Forms.CheckState.Checked;
this.typeCheckbox.FlatAppearance.BorderSize = 0;
this.typeCheckbox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102)))));
this.typeCheckbox.Location = new System.Drawing.Point(533, 563);
this.typeCheckbox.Location = new System.Drawing.Point(533, 676);
this.typeCheckbox.Name = "typeCheckbox";
this.typeCheckbox.Size = new System.Drawing.Size(92, 17);
this.typeCheckbox.TabIndex = 98;
@@ -999,12 +1006,88 @@
this.aboutLabel.MouseLeave += new System.EventHandler(this.aboutLabel_MouseLeave);
this.aboutLabel.MouseHover += new System.EventHandler(this.aboutLabel_MouseHover);
//
// enableBtnsButton
//
this.enableBtnsButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(112)))), ((int)(((byte)(239)))));
this.enableBtnsButton.FlatAppearance.BorderSize = 0;
this.enableBtnsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.enableBtnsButton.ForeColor = System.Drawing.Color.White;
this.enableBtnsButton.Location = new System.Drawing.Point(597, 28);
this.enableBtnsButton.Name = "enableBtnsButton";
this.enableBtnsButton.Size = new System.Drawing.Size(120, 23);
this.enableBtnsButton.TabIndex = 100;
this.enableBtnsButton.Text = "Re-Enable Buttons";
this.enableBtnsButton.UseVisualStyleBackColor = false;
this.enableBtnsButton.Visible = false;
this.enableBtnsButton.Click += new System.EventHandler(this.enableBtnsButton_Click);
//
// hideDebugButton
//
this.hideDebugButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(112)))), ((int)(((byte)(239)))));
this.hideDebugButton.FlatAppearance.BorderSize = 0;
this.hideDebugButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.hideDebugButton.ForeColor = System.Drawing.Color.White;
this.hideDebugButton.Location = new System.Drawing.Point(243, 12);
this.hideDebugButton.Name = "hideDebugButton";
this.hideDebugButton.Size = new System.Drawing.Size(54, 23);
this.hideDebugButton.TabIndex = 101;
this.hideDebugButton.Text = "Hide";
this.hideDebugButton.UseVisualStyleBackColor = false;
this.hideDebugButton.Visible = false;
this.hideDebugButton.Click += new System.EventHandler(this.hideDebugButton_Click);
//
// maxLengthLabel
//
this.maxLengthLabel.AutoSize = true;
this.maxLengthLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102)))));
this.maxLengthLabel.Location = new System.Drawing.Point(530, 567);
this.maxLengthLabel.Name = "maxLengthLabel";
this.maxLengthLabel.Size = new System.Drawing.Size(121, 13);
this.maxLengthLabel.TabIndex = 102;
this.maxLengthLabel.Text = "Max File Name Length**";
//
// panel9
//
this.panel9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102)))));
this.panel9.Location = new System.Drawing.Point(653, 586);
this.panel9.Name = "panel9";
this.panel9.Size = new System.Drawing.Size(68, 1);
this.panel9.TabIndex = 92;
//
// maxLengthTextbox
//
this.maxLengthTextbox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.maxLengthTextbox.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.maxLengthTextbox.ForeColor = System.Drawing.Color.White;
this.maxLengthTextbox.Location = new System.Drawing.Point(653, 567);
this.maxLengthTextbox.Multiline = true;
this.maxLengthTextbox.Name = "maxLengthTextbox";
this.maxLengthTextbox.Size = new System.Drawing.Size(68, 17);
this.maxLengthTextbox.TabIndex = 91;
this.maxLengthTextbox.TextChanged += new System.EventHandler(this.maxLengthTextbox_TextChanged);
//
// maxLengthWarnLabel
//
this.maxLengthWarnLabel.AutoSize = true;
this.maxLengthWarnLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(88)))), ((int)(((byte)(92)))), ((int)(((byte)(102)))));
this.maxLengthWarnLabel.Location = new System.Drawing.Point(819, 711);
this.maxLengthWarnLabel.Name = "maxLengthWarnLabel";
this.maxLengthWarnLabel.Size = new System.Drawing.Size(107, 13);
this.maxLengthWarnLabel.TabIndex = 103;
this.maxLengthWarnLabel.Text = "** = Max value is 110";
//
// 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, 733);
this.Controls.Add(this.maxLengthWarnLabel);
this.Controls.Add(this.panel9);
this.Controls.Add(this.maxLengthTextbox);
this.Controls.Add(this.maxLengthLabel);
this.Controls.Add(this.hideDebugButton);
this.Controls.Add(this.enableBtnsButton);
this.Controls.Add(this.aboutLabel);
this.Controls.Add(this.typeCheckbox);
this.Controls.Add(this.artSizeSelect);
@@ -1170,6 +1253,12 @@
private System.Windows.Forms.Label artSizeLabel;
private System.Windows.Forms.CheckBox typeCheckbox;
private System.Windows.Forms.Label aboutLabel;
private System.Windows.Forms.Button enableBtnsButton;
private System.Windows.Forms.Button hideDebugButton;
private System.Windows.Forms.Label maxLengthLabel;
private System.Windows.Forms.Panel panel9;
private System.Windows.Forms.TextBox maxLengthTextbox;
private System.Windows.Forms.Label maxLengthWarnLabel;
}
}

View File

@@ -61,6 +61,7 @@ namespace QobuzDownloaderX
public string finalTrackNameVersionPath { get; set; }
public int MaxLength { get; set; }
public int devClickEggThingValue { get; set; }
public int debugMode { get; set; }
// Important strings
public string loc { get; set; }
@@ -114,8 +115,6 @@ namespace QobuzDownloaderX
private void Form1_Load(object sender, EventArgs e)
{
MaxLength = 36;
// Set main form size on launch and bring to center.
this.Height = 533;
this.CenterToScreen();
@@ -183,7 +182,10 @@ namespace QobuzDownloaderX
formatIdString = Settings.Default.qualityFormat;
audioFileType = Settings.Default.audioType;
artSizeSelect.SelectedIndex = Settings.Default.savedArtSize;
MaxLength = Settings.Default.savedMaxLength;
artSize = artSizeSelect.Text;
maxLengthTextbox.Text = MaxLength.ToString();
#endregion
// Check if there's no selected path saved.
@@ -213,6 +215,16 @@ namespace QobuzDownloaderX
devClickEggThingValue = 0;
// Debug mode for things that are only for testing, or shouldn't be on public releases. At the moment, does nothing.
if (!Debugger.IsAttached)
{
debugMode = 0;
}
else
{
debugMode = 1;
}
// Show app_secret value.
//output.Invoke(new Action(() => output.AppendText("\r\n\r\napp_secret = " + appSecret)));
@@ -232,22 +244,27 @@ namespace QobuzDownloaderX
// return date.ToString("yyyy-MM-dd");
//}
static string DecodeEncodedNonAsciiCharacters(string value)
{
return Regex.Replace(
if (value != null)
{
return Regex.Replace(
value,
@"\\u(?<Value>[a-zA-Z0-9]{4})",
m =>
{
return ((char)int.Parse(m.Groups["Value"].Value, NumberStyles.HexNumber)).ToString();
});
}
else
{
return null;
}
}
static string GetMd5Hash(MD5 md5Hash, string input)
{
// Convert the input string to a byte array and compute the hash.
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
@@ -640,7 +657,7 @@ namespace QobuzDownloaderX
#endregion
// Grab all Track IDs listed on the API.
string trackIDsPattern = "\"version\":(?:.*?),\"id\":(?<trackId>.*?),";
string trackIDsPattern = "\"isrc\":\"(?:.*?)\"(?:.*?)\"version\":(?:.*?),\"id\":(?<trackId>.*?),";
string trackIDsInput = albumIDResponseString;
RegexOptions trackIDsOptions = RegexOptions.Multiline;
@@ -667,13 +684,20 @@ namespace QobuzDownloaderX
JObject joTrackResponse = JObject.Parse(trackIDResponseString);
#region Get Information (Tags, Titles, etc.)
// Reset troublesome strings (strings that stick around if new value is null)
composerName = null;
// Grab tag strings
albumArtist = (string)joTrackResponse["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist);
albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
try
{
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
}
catch { performerName = null; performerNamePath = null; /*Set to null and Ignore if fails*/ }
try { composerName = (string)joTrackResponse["composer"]["name"]; composerName = DecodeEncodedNonAsciiCharacters(composerName); } catch { /*Ignore if fails*/ }
@@ -804,9 +828,12 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
}
if (performerNamePath.Length > MaxLength)
if (performerName != null)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
if (performerNamePath.Length > MaxLength)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
}
}
if (albumNamePath.Length > MaxLength)
@@ -1438,7 +1465,7 @@ namespace QobuzDownloaderX
#endregion
// Grab all Track IDs listed on the API.
string trackIDsPattern = "\"version\":(?:.*?),\"id\":(?<trackId>.*?),";
string trackIDsPattern = "\"isrc\":\"(?:.*?)\"(?:.*?)\"version\":(?:.*?),\"id\":(?<trackId>.*?),";
string trackIDsInput = albumIDResponseString;
RegexOptions trackIDsOptions = RegexOptions.Multiline;
@@ -1465,13 +1492,20 @@ namespace QobuzDownloaderX
JObject joTrackResponse = JObject.Parse(trackIDResponseString);
#region Get Information (Tags, Titles, etc.)
// Reset troublesome strings (strings that stick around if new value is null)
composerName = null;
// Grab tag strings
albumArtist = (string)joTrackResponse["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist);
albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
try
{
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
}
catch { performerName = null; performerNamePath = null; /*Set to null and Ignore if fails*/ }
try { composerName = (string)joTrackResponse["composer"]["name"]; composerName = DecodeEncodedNonAsciiCharacters(composerName); } catch { /*Ignore if fails*/ }
@@ -1602,9 +1636,12 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
}
if (performerNamePath.Length > MaxLength)
if (performerName != null)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
if (performerNamePath.Length > MaxLength)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
}
}
if (albumNamePath.Length > MaxLength)
@@ -2237,7 +2274,7 @@ namespace QobuzDownloaderX
#endregion
// Grab all Track IDs listed on the API.
string trackIDsPattern = "\"version\":(?:.*?),\"id\":(?<trackId>.*?),";
string trackIDsPattern = "\"isrc\":\"(?:.*?)\"(?:.*?)\"version\":(?:.*?),\"id\":(?<trackId>.*?),";
string trackIDsInput = albumIDResponseString;
RegexOptions trackIDsOptions = RegexOptions.Multiline;
@@ -2264,13 +2301,20 @@ namespace QobuzDownloaderX
JObject joTrackResponse = JObject.Parse(trackIDResponseString);
#region Get Information (Tags, Titles, etc.)
// Reset troublesome strings (strings that stick around if new value is null)
composerName = null;
// Grab tag strings
albumArtist = (string)joTrackResponse["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist);
albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(albumArtist);
performerNamePath = GetSafeFilename(performerName);
try
{
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
}
catch { performerName = null; performerNamePath = null; /*Set to null and Ignore if fails*/ }
try { composerName = (string)joTrackResponse["composer"]["name"]; composerName = DecodeEncodedNonAsciiCharacters(composerName); } catch { /*Ignore if fails*/ }
@@ -2401,9 +2445,12 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
}
if (performerNamePath.Length > MaxLength)
if (performerName != null)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
if (performerNamePath.Length > MaxLength)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
}
}
if (albumNamePath.Length > MaxLength)
@@ -3004,7 +3051,7 @@ namespace QobuzDownloaderX
#endregion
// Grab all Track IDs listed on the API.
string trackIDsPattern = "\"version\":(?:.*?),\"id\":(?<trackId>.*?),";
string trackIDsPattern = "\"isrc\":\"(?:.*?)\"(?:.*?)\"version\":(?:.*?),\"id\":(?<trackId>.*?),";
string trackIDsInput = albumIDResponseString;
RegexOptions trackIDsOptions = RegexOptions.Multiline;
@@ -3030,15 +3077,22 @@ namespace QobuzDownloaderX
JObject joTrackResponse = JObject.Parse(trackIDResponseString);
#region Get Information (Tags, Titles, etc.)
// Reset troublesome strings (strings that stick around if new value is null)
composerName = null;
// Grab tag strings
albumArtist = (string)joTrackResponse["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist);
albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
try
{
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
}
catch { performerName = null; performerNamePath = null; /*Set to null and Ignore if fails*/ }
try { composerName = (string)joTrackResponse["composer"]["name"]; composerName = DecodeEncodedNonAsciiCharacters(composerName); } catch { /*Ignore if fails*/ }
try { composerName = (string)joTrackResponse["composer"]["name"]; composerName = DecodeEncodedNonAsciiCharacters(composerName); } catch { composerName = null; /*Set to null and Ignore if fails*/ }
advisory = (string)joTrackResponse["parental_warning"];
@@ -3167,9 +3221,12 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
}
if (performerNamePath.Length > MaxLength)
if (performerName != null)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
if (performerNamePath.Length > MaxLength)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
}
}
if (albumNamePath.Length > MaxLength)
@@ -3743,15 +3800,22 @@ namespace QobuzDownloaderX
#endregion
#region Get Information (Tags, Titles, etc.)
// Reset troublesome strings (strings that stick around if new value is null)
composerName = null;
// Grab tag strings
albumArtist = (string)joResponse2["album"]["artist"]["name"]; albumArtist = DecodeEncodedNonAsciiCharacters(albumArtist);
albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
performerName = (string)joResponse2["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
try
{
performerName = (string)joResponse2["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(performerName);
}
catch { performerName = null; performerNamePath = null; /*Set to null and Ignore if fails*/ }
try { composerName = (string)joResponse2["composer"]["name"]; composerName = DecodeEncodedNonAsciiCharacters(composerName); } catch { /*Ignore if fails*/ }
try { composerName = (string)joResponse2["composer"]["name"]; composerName = DecodeEncodedNonAsciiCharacters(composerName); } catch { composerName = null; /*Set to null and Ignore if fails*/ }
advisory = (string)joResponse2["parental_warning"];
@@ -3880,9 +3944,12 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
}
if (performerNamePath.Length > MaxLength)
if (performerName != null)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
if (performerNamePath.Length > MaxLength)
{
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
}
}
if (albumNamePath.Length > MaxLength)
@@ -4457,6 +4524,41 @@ namespace QobuzDownloaderX
Settings.Default.commentText = commentTextbox.Text;
Settings.Default.Save();
}
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();
}
private void maxLengthTextbox_TextChanged(object sender, EventArgs e)
{
if (maxLengthTextbox.Text != null)
{
try
{
if (Convert.ToInt32(maxLengthTextbox.Text) > 110)
{
maxLengthTextbox.Text = "110";
}
Settings.Default.savedMaxLength = Convert.ToInt32(maxLengthTextbox.Text);
Settings.Default.Save();
MaxLength = Convert.ToInt32(maxLengthTextbox.Text);
}
catch (Exception ex)
{
MaxLength = 36;
}
}
else
{
MaxLength = 36;
}
}
#endregion
#region Quality Options
@@ -4638,6 +4740,8 @@ namespace QobuzDownloaderX
if (devClickEggThingValue >= 3)
{
streamableCheckbox.Visible = true;
enableBtnsButton.Visible = true;
hideDebugButton.Visible = true;
displaySecretButton.Visible = true;
secretTextbox.Visible = true;
hiddenTextPanel.Visible = true;
@@ -4648,9 +4752,23 @@ namespace QobuzDownloaderX
displaySecretButton.Visible = false;
secretTextbox.Visible = false;
hiddenTextPanel.Visible = false;
enableBtnsButton.Visible = false;
hideDebugButton.Visible = false;
}
}
private void hideDebugButton_Click(object sender, EventArgs e)
{
streamableCheckbox.Visible = false;
displaySecretButton.Visible = false;
secretTextbox.Visible = false;
hiddenTextPanel.Visible = false;
enableBtnsButton.Visible = false;
hideDebugButton.Visible = false;
devClickEggThingValue = 0;
}
private void displaySecretButton_Click(object sender, EventArgs e)
{
secretTextbox.Text = appSecret;
@@ -4673,18 +4791,15 @@ namespace QobuzDownloaderX
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();
}
// For converting illegal filename characters to an underscore.
public string GetSafeFilename(string filename)
{
return string.Join("_", filename.Split(Path.GetInvalidFileNameChars()));
}
private void enableBtnsButton_Click(object sender, EventArgs e)
{
enableBoxes(sender, e);
}
}
}

View File

@@ -447,16 +447,27 @@ namespace QobuzDownloaderX
{
loginBG.WorkerSupportsCancellation = true;
// Create HttpClient to grab Track ID
// Create HttpClient for logging in using Napster / Rhapsody API.
var loginClient = new HttpClient();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; //Make connection secure
loginClient.DefaultRequestHeaders.Add("Authorization", "Basic WlRKbE9XTmhaR1V0TnpsbVpTMDBaR1UyTFRrd1lqTXRaRGsxT0RSbE1Ea3dPRE01Ok1UUmpaVFZqTTJFdE9HVmxaaTAwT1RVM0xXRm1Oamt0TlRsbE9ERmhObVl5TnpJNQ=="); //This value is from logging in to the Napster Android app.
// Create HttpClient to grab Track ID
var loginClient2 = new HttpClient();
// Run through TLS to allow secure connection.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
// Set user-agent to Firefox.
loginClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0");
var loginURL = "https://www.qobuz.com/api.json/0.2/user/login"; //Set base URL
var parameters = new Dictionary<string, string> { { "username", emailTextbox.Text }, { "email", emailTextbox.Text }, { "password", passwordTextbox.Text }, { "extra", "partner" }, { "app_id", appID } }; //Set email & password parameters
var encodedContent = new FormUrlEncodedContent(parameters); //Add parameters as encoded content to login
// Grab response from Rhapsody to get Track IDs from Album response.
var loginUrl = "https://www.qobuz.com/api.json/0.2/user/login?email=" + emailTextbox.Text + "&password=" + passwordTextbox.Text + "&app_id=" + appID;
var loginResponse = await loginClient.GetAsync(loginUrl);
var loginResponse = await loginClient.PostAsync(loginURL, encodedContent);
string loginResponseString = loginResponse.Content.ReadAsStringAsync().Result;
// Grab metadata from API JSON response

View File

@@ -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.17")]
[assembly: AssemblyFileVersion("0.9.9.17")]
[assembly: AssemblyVersion("0.9.9.21")]
[assembly: AssemblyFileVersion("0.9.9.21")]

View File

@@ -442,5 +442,17 @@ namespace QobuzDownloaderX.Properties {
this["typeTag"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("36")]
public int savedMaxLength {
get {
return ((int)(this["savedMaxLength"]));
}
set {
this["savedMaxLength"] = value;
}
}
}
}

View File

@@ -107,5 +107,8 @@
<Setting Name="typeTag" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="savedMaxLength" Type="System.Int32" Scope="User">
<Value Profile="(Default)">36</Value>
</Setting>
</Settings>
</SettingsFile>