Fix issues with downloaded album art.

This commit is contained in:
Grigory Chudov
2018-11-25 15:12:51 -05:00
parent ededb2112c
commit 3f121a8f9e
8 changed files with 1464 additions and 900 deletions

View File

@@ -198,6 +198,7 @@ namespace JDP {
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
resources.ApplyResources(this.toolStripStatusLabel1, "toolStripStatusLabel1");
this.toolStripStatusLabel1.Spring = true;
//
@@ -208,6 +209,7 @@ namespace JDP {
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
this.toolStripStatusLabelProcessed.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenOuter;
this.toolStripStatusLabelProcessed.Name = "toolStripStatusLabelProcessed";
this.toolStripStatusLabelProcessed.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
resources.ApplyResources(this.toolStripStatusLabelProcessed, "toolStripStatusLabelProcessed");
//
// toolStripStatusLabelCTDB
@@ -219,6 +221,7 @@ namespace JDP {
resources.ApplyResources(this.toolStripStatusLabelCTDB, "toolStripStatusLabelCTDB");
this.toolStripStatusLabelCTDB.Image = global::JDP.Properties.Resources.cdrepair1;
this.toolStripStatusLabelCTDB.Name = "toolStripStatusLabelCTDB";
this.toolStripStatusLabelCTDB.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
//
// toolStripStatusLabelAR
//
@@ -229,12 +232,14 @@ namespace JDP {
resources.ApplyResources(this.toolStripStatusLabelAR, "toolStripStatusLabelAR");
this.toolStripStatusLabelAR.Image = global::JDP.Properties.Resources.AR;
this.toolStripStatusLabelAR.Name = "toolStripStatusLabelAR";
this.toolStripStatusLabelAR.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
this.toolStripStatusLabelAR.Padding = new System.Windows.Forms.Padding(0, 0, 5, 0);
//
// toolStripProgressBar2
//
this.toolStripProgressBar2.AutoToolTip = true;
this.toolStripProgressBar2.Name = "toolStripProgressBar2";
this.toolStripProgressBar2.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
resources.ApplyResources(this.toolStripProgressBar2, "toolStripProgressBar2");
this.toolStripProgressBar2.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
//

View File

@@ -973,19 +973,6 @@ namespace JDP
entry.Metadata.CopyMetadata(dlg.ChosenRelease.metadata);
}
}
if (dlgRes != DialogResult.Cancel)
{
if (cueSheet.AlbumArt.Count == 0 && cueSheet.Metadata.AlbumArt.Count > 0)
{
var ms = new MemoryStream();
var image = cueSheet.Metadata.AlbumArt.Find(x => x.primary) ?? cueSheet.Metadata.AlbumArt[0];
if (cueSheet.CTDB.FetchFile(image.uri, ms))
{
var blob = new TagLib.ByteVector(ms.ToArray());
cueSheet.AlbumArt.Add(new TagLib.Picture(new TagLib.ByteVector(blob)));
}
}
}
dlg.Close();
}
else if (_profile._config.advanced.CacheMetadata)
@@ -1006,6 +993,8 @@ namespace JDP
if (dlgRes == DialogResult.Cancel)
return;
cueSheet.LoadAndResizeAlbumArt();
cueSheet.GenerateFilenames(audioEncoderType, outputFormat, pathOut);
List<string> outputExists = cueSheet.OutputExists();
@@ -1040,6 +1029,10 @@ namespace JDP
}
if (outputExists.Count == 0)
{
this.Invoke((MethodInvoker)delegate ()
{
pictureBoxMotd.Image = cueSheet.Cover ?? motdImage;
});
cueSheet.UsePregapForFirstTrackInSingleFile = _usePregapForFirstTrackInSingleFile && !outputAudio;
if (script == null || script.name == "default")
{
@@ -1212,7 +1205,7 @@ namespace JDP
{
if (e.percent == 0)
{
toolStripStatusLabelProcessed.Visible = false;
toolStripStatusLabelProcessed.Text = "";
toolStripProgressBar2.ToolTipText = "";
}
else if (e.percent > 0.02)
@@ -1227,9 +1220,9 @@ namespace JDP
}
toolStripProgressBar2.ToolTipText = String.Format("{0}:{1:00}/{2}:{3:00}", (int)span.TotalMinutes, span.Seconds, (int)eta.TotalMinutes, eta.Seconds);
toolStripStatusLabelProcessed.Text = String.Format("{0}@{1}", toolStripProgressBar2.ToolTipText, speedStr);
toolStripStatusLabelProcessed.Visible = true;
}
toolStripStatusLabel1.Text = e.status.Replace("&", "&&");
toolStripStatusLabel1.ToolTipText = e.status;
toolStripProgressBar2.Value = Math.Max(0, Math.Min(100, (int)(e.percent * 100)));
toolStripStatusLabelAR.Enabled = e.cueSheet != null && e.cueSheet.ArVerify != null && e.cueSheet.ArVerify.ARStatus == null;
@@ -1290,7 +1283,7 @@ namespace JDP
{
UpdateActions();
pictureBoxMotd.Image = motdImage;
toolStripStatusLabelProcessed.Visible = false;
toolStripStatusLabelProcessed.Text = "";
}
//rbGapsLeftOut.Visible =

File diff suppressed because it is too large Load Diff

View File

@@ -186,9 +186,6 @@ namespace JDP
ri.metadata.Tracks[i].ISRC = CUE.Metadata.Tracks[i].ISRC;
}
CUE.CopyMetadata(ri.metadata);
// TODO: copy album art
}
private void AutoResizeList(ListView list, int mainCol)
@@ -260,11 +257,23 @@ namespace JDP
pictureBox1.Image = null;
}
pictureBox1.ImageLocation = null;
if (r.metadata.AlbumArt.Count > 0)
if (r.metadata.AlbumArt.Count > 0 || r.cover != null)
{
pictureBox1.Show();
var image = r.metadata.AlbumArt.Find(x => x.primary) ?? r.metadata.AlbumArt[0];
pictureBox1.ImageLocation = image.uri150;
if (r.cover != null)
{
using (MemoryStream imageStream = new MemoryStream(r.cover, 0, r.cover.Length))
try
{
pictureBox1.Image = Image.FromStream(imageStream);
}
catch { }
}
else
{
var image = r.metadata.AlbumArt.Find(x => x.primary) ?? r.metadata.AlbumArt[0];
pictureBox1.ImageLocation = image.uri150;
}
} else
{
pictureBox1.Hide();