0.9.9.18
This commit is contained in:
AiiR 2020-07-20 17:17:03 -04:00
parent ffbd8e521e
commit 3962e0f682
2 changed files with 68 additions and 28 deletions

View File

@ -233,8 +233,9 @@ namespace QobuzDownloaderX
// return date.ToString("yyyy-MM-dd"); // return date.ToString("yyyy-MM-dd");
//} //}
static string DecodeEncodedNonAsciiCharacters(string value) static string DecodeEncodedNonAsciiCharacters(string value)
{
if (value != null)
{ {
return Regex.Replace( return Regex.Replace(
value, value,
@ -244,10 +245,14 @@ namespace QobuzDownloaderX
return ((char)int.Parse(m.Groups["Value"].Value, NumberStyles.HexNumber)).ToString(); return ((char)int.Parse(m.Groups["Value"].Value, NumberStyles.HexNumber)).ToString();
}); });
} }
else
{
return null;
}
}
static string GetMd5Hash(MD5 md5Hash, string input) static string GetMd5Hash(MD5 md5Hash, string input)
{ {
// Convert the input string to a byte array and compute the hash. // Convert the input string to a byte array and compute the hash.
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input)); byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
@ -672,8 +677,12 @@ namespace QobuzDownloaderX
albumArtistPath = GetSafeFilename(albumArtist); albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist)); albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
try
{
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName); performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(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 { /*Ignore if fails*/ }
@ -804,10 +813,13 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd(); albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
} }
if (performerName != null)
{
if (performerNamePath.Length > MaxLength) if (performerNamePath.Length > MaxLength)
{ {
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd(); performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
} }
}
if (albumNamePath.Length > MaxLength) if (albumNamePath.Length > MaxLength)
{ {
@ -1470,8 +1482,12 @@ namespace QobuzDownloaderX
albumArtistPath = GetSafeFilename(albumArtist); albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist)); albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
try
{
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName); performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(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 { /*Ignore if fails*/ }
@ -1602,10 +1618,13 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd(); albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
} }
if (performerName != null)
{
if (performerNamePath.Length > MaxLength) if (performerNamePath.Length > MaxLength)
{ {
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd(); performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
} }
}
if (albumNamePath.Length > MaxLength) if (albumNamePath.Length > MaxLength)
{ {
@ -2269,8 +2288,12 @@ namespace QobuzDownloaderX
albumArtistPath = GetSafeFilename(albumArtist); albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist)); albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(albumArtist); try
{
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(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 { /*Ignore if fails*/ }
@ -2401,10 +2424,13 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd(); albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
} }
if (performerName != null)
{
if (performerNamePath.Length > MaxLength) if (performerNamePath.Length > MaxLength)
{ {
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd(); performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
} }
}
if (albumNamePath.Length > MaxLength) if (albumNamePath.Length > MaxLength)
{ {
@ -3035,10 +3061,14 @@ namespace QobuzDownloaderX
albumArtistPath = GetSafeFilename(albumArtist); albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist)); albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
try
{
performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName); performerName = (string)joTrackResponse["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(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"]; advisory = (string)joTrackResponse["parental_warning"];
@ -3167,10 +3197,13 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd(); albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
} }
if (performerName != null)
{
if (performerNamePath.Length > MaxLength) if (performerNamePath.Length > MaxLength)
{ {
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd(); performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
} }
}
if (albumNamePath.Length > MaxLength) if (albumNamePath.Length > MaxLength)
{ {
@ -3748,10 +3781,14 @@ namespace QobuzDownloaderX
albumArtistPath = GetSafeFilename(albumArtist); albumArtistPath = GetSafeFilename(albumArtist);
albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist)); albumArtistTextBox.Invoke(new Action(() => albumArtistTextBox.Text = albumArtist));
try
{
performerName = (string)joResponse2["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName); performerName = (string)joResponse2["performer"]["name"]; performerName = DecodeEncodedNonAsciiCharacters(performerName);
performerNamePath = GetSafeFilename(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"]; advisory = (string)joResponse2["parental_warning"];
@ -3880,10 +3917,13 @@ namespace QobuzDownloaderX
albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd(); albumArtistPath = albumArtistPath.Substring(0, MaxLength).TrimEnd();
} }
if (performerName != null)
{
if (performerNamePath.Length > MaxLength) if (performerNamePath.Length > MaxLength)
{ {
performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd(); performerNamePath = performerNamePath.Substring(0, MaxLength).TrimEnd();
} }
}
if (albumNamePath.Length > MaxLength) if (albumNamePath.Length > MaxLength)
{ {

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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.9.17")] [assembly: AssemblyVersion("0.9.9.18")]
[assembly: AssemblyFileVersion("0.9.9.17")] [assembly: AssemblyFileVersion("0.9.9.18")]