mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Fix issues with downloaded album art.
This commit is contained in:
@@ -240,7 +240,7 @@ namespace CUETools.Processor
|
|||||||
Country = metadata.Country;
|
Country = metadata.Country;
|
||||||
Label = metadata.Label;
|
Label = metadata.Label;
|
||||||
LabelNo = metadata.LabelNo;
|
LabelNo = metadata.LabelNo;
|
||||||
AlbumArt = metadata.AlbumArt;
|
AlbumArt = metadata.AlbumArt.ConvertAll(x => new CTDB.CTDBResponseMetaImage(x));
|
||||||
for (int i = 0; i < Tracks.Count; i++)
|
for (int i = 0; i < Tracks.Count; i++)
|
||||||
{
|
{
|
||||||
Tracks[i].Title = metadata.Tracks[i].Title;
|
Tracks[i].Title = metadata.Tracks[i].Title;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace CUETools.Processor
|
|||||||
public CUEMetadata metadata { get; set; }
|
public CUEMetadata metadata { get; set; }
|
||||||
public CDImageLayout TOC { get; set; }
|
public CDImageLayout TOC { get; set; }
|
||||||
public string ImageKey { get; set; }
|
public string ImageKey { get; set; }
|
||||||
|
public byte[] cover { get; set; }
|
||||||
|
|
||||||
public CUEMetadataEntry(CUEMetadata metadata, CDImageLayout TOC, string key)
|
public CUEMetadataEntry(CUEMetadata metadata, CDImageLayout TOC, string key)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ namespace CUETools.Processor
|
|||||||
private string _htoaFilename, _singleFilename;
|
private string _htoaFilename, _singleFilename;
|
||||||
private bool _hasHTOAFilename = false, _hasTrackFilenames = false, _hasSingleFilename = false, _appliedWriteOffset;
|
private bool _hasHTOAFilename = false, _hasTrackFilenames = false, _hasSingleFilename = false, _appliedWriteOffset;
|
||||||
private bool _hasEmbeddedCUESheet;
|
private bool _hasEmbeddedCUESheet;
|
||||||
|
private bool _hasEmbeddedArtwork;
|
||||||
private bool _paddedToFrame, _truncated4608, _usePregapForFirstTrackInSingleFile;
|
private bool _paddedToFrame, _truncated4608, _usePregapForFirstTrackInSingleFile;
|
||||||
private int _writeOffset;
|
private int _writeOffset;
|
||||||
private CUEAction _action;
|
private CUEAction _action;
|
||||||
@@ -130,9 +131,12 @@ namespace CUETools.Processor
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (AlbumArt == null || AlbumArt.Count == 0)
|
if (AlbumArt == null)
|
||||||
|
return null;
|
||||||
|
var picture = AlbumArt.Find(x => x.Type == TagLib.PictureType.FrontCover) ??
|
||||||
|
AlbumArt.Find(x => x.Type != TagLib.PictureType.NotAPicture);
|
||||||
|
if (picture == null)
|
||||||
return null;
|
return null;
|
||||||
TagLib.IPicture picture = AlbumArt[0];
|
|
||||||
using (MemoryStream imageStream = new MemoryStream(picture.Data.Data, 0, picture.Data.Count))
|
using (MemoryStream imageStream = new MemoryStream(picture.Data.Data, 0, picture.Data.Count))
|
||||||
try { return Image.FromStream(imageStream); }
|
try { return Image.FromStream(imageStream); }
|
||||||
catch { }
|
catch { }
|
||||||
@@ -551,6 +555,7 @@ namespace CUETools.Processor
|
|||||||
_minDataTrackLength = null;
|
_minDataTrackLength = null;
|
||||||
hdcdDecoder = null;
|
hdcdDecoder = null;
|
||||||
_hasEmbeddedCUESheet = false;
|
_hasEmbeddedCUESheet = false;
|
||||||
|
_hasEmbeddedArtwork = false;
|
||||||
_isArchive = false;
|
_isArchive = false;
|
||||||
_isCD = false;
|
_isCD = false;
|
||||||
_useLocalDB = false;
|
_useLocalDB = false;
|
||||||
@@ -837,8 +842,15 @@ namespace CUETools.Processor
|
|||||||
dbmeta = myEntry.Metadata;
|
dbmeta = myEntry.Metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte[] frontCover = null;
|
||||||
|
{
|
||||||
|
var picture = AlbumArt.Find(x => x.Type == TagLib.PictureType.FrontCover) ??
|
||||||
|
AlbumArt.Find(x => x.Type != TagLib.PictureType.NotAPicture);
|
||||||
|
if (picture != null) frontCover = picture.Data.Data;
|
||||||
|
}
|
||||||
|
|
||||||
if (dbmeta != null)
|
if (dbmeta != null)
|
||||||
Releases.Add(new CUEMetadataEntry(dbmeta, TOC, "local"));
|
Releases.Add(new CUEMetadataEntry(dbmeta, TOC, "local") { cover = frontCover });
|
||||||
|
|
||||||
//if (useCache)
|
//if (useCache)
|
||||||
//{
|
//{
|
||||||
@@ -859,12 +871,12 @@ namespace CUETools.Processor
|
|||||||
if (dbmeta == null || !dbmeta.Contains(cueMetadata))
|
if (dbmeta == null || !dbmeta.Contains(cueMetadata))
|
||||||
{
|
{
|
||||||
if (cueMetadata.Contains(taglibMetadata) || !taglibMetadata.Contains(cueMetadata))
|
if (cueMetadata.Contains(taglibMetadata) || !taglibMetadata.Contains(cueMetadata))
|
||||||
Releases.Add(new CUEMetadataEntry(new CUEMetadata(cueMetadata), TOC, "cue"));
|
Releases.Add(new CUEMetadataEntry(new CUEMetadata(cueMetadata), TOC, "cue") { cover = frontCover });
|
||||||
}
|
}
|
||||||
if (dbmeta == null || !dbmeta.Contains(taglibMetadata))
|
if (dbmeta == null || !dbmeta.Contains(taglibMetadata))
|
||||||
{
|
{
|
||||||
if (!cueMetadata.Contains(taglibMetadata))
|
if (!cueMetadata.Contains(taglibMetadata))
|
||||||
Releases.Add(new CUEMetadataEntry(new CUEMetadata(taglibMetadata), TOC, "tags"));
|
Releases.Add(new CUEMetadataEntry(new CUEMetadata(taglibMetadata), TOC, "tags") { cover = frontCover });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,7 +884,7 @@ namespace CUETools.Processor
|
|||||||
{
|
{
|
||||||
foreach (var entry in _localDB)
|
foreach (var entry in _localDB)
|
||||||
if (entry.DiscID == TOC.TOCID && entry.Metadata != null && (dbmeta == null || !dbmeta.Contains(entry.Metadata)))
|
if (entry.DiscID == TOC.TOCID && entry.Metadata != null && (dbmeta == null || !dbmeta.Contains(entry.Metadata)))
|
||||||
Releases.Add(new CUEMetadataEntry(entry.Metadata, TOC, "local"));
|
Releases.Add(new CUEMetadataEntry(entry.Metadata, TOC, "local") { cover = frontCover });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ctdbFound = false;
|
bool ctdbFound = false;
|
||||||
@@ -1737,11 +1749,7 @@ namespace CUETools.Processor
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoadAlbumArt(_tracks[0]._fileInfo ?? _fileInfo);
|
LoadAlbumArt(_tracks[0]._fileInfo ?? _fileInfo);
|
||||||
#if NET47 || NET20
|
|
||||||
ResizeAlbumArt();
|
|
||||||
#endif
|
|
||||||
if (_config.embedAlbumArt || _config.CopyAlbumArt)
|
|
||||||
_albumArt.ForEach(t => _padding += t.Data.Count);
|
|
||||||
if (_config.embedLog && _eacLog != null)
|
if (_config.embedLog && _eacLog != null)
|
||||||
_padding += _eacLog.Length;
|
_padding += _eacLog.Length;
|
||||||
|
|
||||||
@@ -1750,6 +1758,63 @@ namespace CUETools.Processor
|
|||||||
// TODO: It should also be set when assigning a DataTrack!!!
|
// TODO: It should also be set when assigning a DataTrack!!!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadAndResizeAlbumArt()
|
||||||
|
{
|
||||||
|
if (Action != CUEAction.Encode)
|
||||||
|
return;
|
||||||
|
if (!_hasEmbeddedArtwork)
|
||||||
|
{
|
||||||
|
var images = Metadata.AlbumArt;
|
||||||
|
var primaryImages = images.FindAll(x => x.primary);
|
||||||
|
if (primaryImages.Count > 0) images = primaryImages;
|
||||||
|
foreach (var imageMeta in images)
|
||||||
|
{
|
||||||
|
// TODO: load secondary album art?
|
||||||
|
// TODO: load uri150 version first, load full version in background of choice form?
|
||||||
|
var ms = new MemoryStream();
|
||||||
|
if (CTDB.FetchFile(imageMeta.uri, ms))
|
||||||
|
{
|
||||||
|
TagLib.Picture pic = new TagLib.Picture(new TagLib.ByteVector(ms.ToArray()));
|
||||||
|
pic.Description = imageMeta.uri;
|
||||||
|
using (MemoryStream imageStream = new MemoryStream(pic.Data.Data, 0, pic.Data.Count))
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#if NET47 || NET20
|
||||||
|
var image = Image.FromStream(ms);
|
||||||
|
pic.Description += $" ({image.Width}x{image.Height})";
|
||||||
|
//if (image.Height > 0 && image.Width > 0 && (image.Height * 1.0 / image.Width) > 0.9 && (image.Width * 1.0 / image.Height) > 0.9)
|
||||||
|
// isSquare = true;
|
||||||
|
// pic.MimeType = f(image.RawFormat);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
_albumArt.Add(pic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CheckStop();
|
||||||
|
|
||||||
|
if (_albumArt.Count != 1 || _albumArt[0].Type != TagLib.PictureType.FrontCover)
|
||||||
|
{
|
||||||
|
if (_albumArt.Count == 0 || CUEToolsSelection == null)
|
||||||
|
{
|
||||||
|
_albumArt.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CUEToolsSelectionEventArgs e = new CUEToolsSelectionEventArgs();
|
||||||
|
e.choices = _albumArt.ToArray();
|
||||||
|
CUEToolsSelection(this, e);
|
||||||
|
TagLib.IPicture selected = e.selection == -1 ? null : _albumArt[e.selection];
|
||||||
|
_albumArt.RemoveAll(t => t != selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if NET47 || NET20
|
||||||
|
ResizeAlbumArt();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public void UseCUEToolsDB(string userAgent, string driveName, bool fuzzy, CTDBMetadataSearch metadataSearch)
|
public void UseCUEToolsDB(string userAgent, string driveName, bool fuzzy, CTDBMetadataSearch metadataSearch)
|
||||||
{
|
{
|
||||||
ShowProgress((string)"Contacting CUETools database...", 0, null, null);
|
ShowProgress((string)"Contacting CUETools database...", 0, null, null);
|
||||||
@@ -2920,16 +2985,21 @@ namespace CUETools.Processor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadAlbumArt(TagLib.File fileInfo)
|
private void LoadAlbumArt(TagLib.File fileInfo)
|
||||||
{
|
{
|
||||||
if ((_config.extractAlbumArt || _config.CopyAlbumArt) && fileInfo != null)
|
if (_config.extractAlbumArt || _config.CopyAlbumArt)
|
||||||
foreach (TagLib.IPicture picture in fileInfo.Tag.Pictures)
|
{
|
||||||
if (picture.Type == TagLib.PictureType.FrontCover)
|
if (fileInfo != null)
|
||||||
if (picture.MimeType == "image/jpeg")
|
foreach (TagLib.IPicture picture in fileInfo.Tag.Pictures)
|
||||||
{
|
{
|
||||||
_albumArt.Add(picture);
|
if (picture.Type == TagLib.PictureType.NotAPicture) continue;
|
||||||
return;
|
// if (picture.MimeType == "image/jpeg" && picture.Type == TagLib.PictureType.FrontCover)
|
||||||
}
|
_albumArt.Add(picture);
|
||||||
|
_hasEmbeddedArtwork = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_hasEmbeddedArtwork) return;
|
||||||
|
|
||||||
bool isValidName = true;
|
bool isValidName = true;
|
||||||
if ((_config.extractAlbumArt || _config.embedAlbumArt) && !_isCD)
|
if ((_config.extractAlbumArt || _config.embedAlbumArt) && !_isCD)
|
||||||
@@ -2969,7 +3039,6 @@ namespace CUETools.Processor
|
|||||||
if (files.Count > maxChoice) return;
|
if (files.Count > maxChoice) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSquare = false;
|
|
||||||
foreach (string imgPath in files)
|
foreach (string imgPath in files)
|
||||||
{
|
{
|
||||||
TagLib.File.IFileAbstraction file = _isArchive
|
TagLib.File.IFileAbstraction file = _isArchive
|
||||||
@@ -2980,6 +3049,7 @@ namespace CUETools.Processor
|
|||||||
pic.Description = imgPath.Substring(_inputDir.Length).Trim(Path.DirectorySeparatorChar);
|
pic.Description = imgPath.Substring(_inputDir.Length).Trim(Path.DirectorySeparatorChar);
|
||||||
else
|
else
|
||||||
pic.Description = Path.GetFileName(imgPath);
|
pic.Description = Path.GetFileName(imgPath);
|
||||||
|
pic.Type = TagLib.PictureType.Other;
|
||||||
using (MemoryStream imageStream = new MemoryStream(pic.Data.Data, 0, pic.Data.Count))
|
using (MemoryStream imageStream = new MemoryStream(pic.Data.Data, 0, pic.Data.Count))
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -2987,25 +3057,16 @@ namespace CUETools.Processor
|
|||||||
var image = Image.FromStream(imageStream);
|
var image = Image.FromStream(imageStream);
|
||||||
pic.Description += $" ({image.Width}x{image.Height})";
|
pic.Description += $" ({image.Width}x{image.Height})";
|
||||||
if (image.Height > 0 && image.Width > 0 && (image.Height * 1.0 / image.Width) > 0.9 && (image.Width * 1.0 / image.Height) > 0.9)
|
if (image.Height > 0 && image.Width > 0 && (image.Height * 1.0 / image.Width) > 0.9 && (image.Width * 1.0 / image.Height) > 0.9)
|
||||||
isSquare = true;
|
{
|
||||||
|
if (isValidName)
|
||||||
|
pic.Type = TagLib.PictureType.FrontCover;
|
||||||
|
}
|
||||||
// pic.MimeType = f(image.RawFormat);
|
// pic.MimeType = f(image.RawFormat);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
_albumArt.Add(pic);
|
_albumArt.Add(pic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_albumArt.Count == 0 || CUEToolsSelection == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (_albumArt.Count == 1 && isSquare && isValidName)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CUEToolsSelectionEventArgs e = new CUEToolsSelectionEventArgs();
|
|
||||||
e.choices = _albumArt.ToArray();
|
|
||||||
CUEToolsSelection(this, e);
|
|
||||||
TagLib.IPicture selected = e.selection == -1 ? null : _albumArt[e.selection];
|
|
||||||
_albumArt.RemoveAll(t => t != selected);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3014,13 +3075,16 @@ namespace CUETools.Processor
|
|||||||
{
|
{
|
||||||
if (_albumArt == null)
|
if (_albumArt == null)
|
||||||
return;
|
return;
|
||||||
|
int j = 0;
|
||||||
foreach (TagLib.IPicture picture in _albumArt)
|
foreach (TagLib.IPicture picture in _albumArt)
|
||||||
using (MemoryStream imageStream = new MemoryStream(picture.Data.Data, 0, picture.Data.Count))
|
using (MemoryStream imageStream = new MemoryStream(picture.Data.Data, 0, picture.Data.Count))
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
CheckStop();
|
||||||
using (Image img = Image.FromStream(imageStream))
|
using (Image img = Image.FromStream(imageStream))
|
||||||
if (img.Width > _config.maxAlbumArtSize || img.Height > _config.maxAlbumArtSize)
|
if (img.Width > _config.maxAlbumArtSize || img.Height > _config.maxAlbumArtSize)
|
||||||
{
|
{
|
||||||
|
ReportProgress("Resizing Album Art", (double)(j++) / _albumArt.Count);
|
||||||
using (Bitmap small = resizeImage(img, new Size(_config.maxAlbumArtSize, _config.maxAlbumArtSize)))
|
using (Bitmap small = resizeImage(img, new Size(_config.maxAlbumArtSize, _config.maxAlbumArtSize)))
|
||||||
using (MemoryStream encoded = new MemoryStream())
|
using (MemoryStream encoded = new MemoryStream())
|
||||||
{
|
{
|
||||||
@@ -3388,6 +3452,9 @@ namespace CUETools.Processor
|
|||||||
destBPS = 16;
|
destBPS = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_config.embedAlbumArt || _config.CopyAlbumArt)
|
||||||
|
_albumArt.ForEach(t => _padding += t.Data.Count);
|
||||||
|
|
||||||
if (style == CUEStyle.SingleFile || style == CUEStyle.SingleFileWithCUE)
|
if (style == CUEStyle.SingleFile || style == CUEStyle.SingleFileWithCUE)
|
||||||
{
|
{
|
||||||
iDest++;
|
iDest++;
|
||||||
|
|||||||
5
CUETools/frmCUETools.Designer.cs
generated
5
CUETools/frmCUETools.Designer.cs
generated
@@ -198,6 +198,7 @@ namespace JDP {
|
|||||||
// toolStripStatusLabel1
|
// toolStripStatusLabel1
|
||||||
//
|
//
|
||||||
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
||||||
|
this.toolStripStatusLabel1.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||||
resources.ApplyResources(this.toolStripStatusLabel1, "toolStripStatusLabel1");
|
resources.ApplyResources(this.toolStripStatusLabel1, "toolStripStatusLabel1");
|
||||||
this.toolStripStatusLabel1.Spring = true;
|
this.toolStripStatusLabel1.Spring = true;
|
||||||
//
|
//
|
||||||
@@ -208,6 +209,7 @@ namespace JDP {
|
|||||||
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
|
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
|
||||||
this.toolStripStatusLabelProcessed.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenOuter;
|
this.toolStripStatusLabelProcessed.BorderStyle = System.Windows.Forms.Border3DStyle.SunkenOuter;
|
||||||
this.toolStripStatusLabelProcessed.Name = "toolStripStatusLabelProcessed";
|
this.toolStripStatusLabelProcessed.Name = "toolStripStatusLabelProcessed";
|
||||||
|
this.toolStripStatusLabelProcessed.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||||
resources.ApplyResources(this.toolStripStatusLabelProcessed, "toolStripStatusLabelProcessed");
|
resources.ApplyResources(this.toolStripStatusLabelProcessed, "toolStripStatusLabelProcessed");
|
||||||
//
|
//
|
||||||
// toolStripStatusLabelCTDB
|
// toolStripStatusLabelCTDB
|
||||||
@@ -219,6 +221,7 @@ namespace JDP {
|
|||||||
resources.ApplyResources(this.toolStripStatusLabelCTDB, "toolStripStatusLabelCTDB");
|
resources.ApplyResources(this.toolStripStatusLabelCTDB, "toolStripStatusLabelCTDB");
|
||||||
this.toolStripStatusLabelCTDB.Image = global::JDP.Properties.Resources.cdrepair1;
|
this.toolStripStatusLabelCTDB.Image = global::JDP.Properties.Resources.cdrepair1;
|
||||||
this.toolStripStatusLabelCTDB.Name = "toolStripStatusLabelCTDB";
|
this.toolStripStatusLabelCTDB.Name = "toolStripStatusLabelCTDB";
|
||||||
|
this.toolStripStatusLabelCTDB.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||||
//
|
//
|
||||||
// toolStripStatusLabelAR
|
// toolStripStatusLabelAR
|
||||||
//
|
//
|
||||||
@@ -229,12 +232,14 @@ namespace JDP {
|
|||||||
resources.ApplyResources(this.toolStripStatusLabelAR, "toolStripStatusLabelAR");
|
resources.ApplyResources(this.toolStripStatusLabelAR, "toolStripStatusLabelAR");
|
||||||
this.toolStripStatusLabelAR.Image = global::JDP.Properties.Resources.AR;
|
this.toolStripStatusLabelAR.Image = global::JDP.Properties.Resources.AR;
|
||||||
this.toolStripStatusLabelAR.Name = "toolStripStatusLabelAR";
|
this.toolStripStatusLabelAR.Name = "toolStripStatusLabelAR";
|
||||||
|
this.toolStripStatusLabelAR.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||||
this.toolStripStatusLabelAR.Padding = new System.Windows.Forms.Padding(0, 0, 5, 0);
|
this.toolStripStatusLabelAR.Padding = new System.Windows.Forms.Padding(0, 0, 5, 0);
|
||||||
//
|
//
|
||||||
// toolStripProgressBar2
|
// toolStripProgressBar2
|
||||||
//
|
//
|
||||||
this.toolStripProgressBar2.AutoToolTip = true;
|
this.toolStripProgressBar2.AutoToolTip = true;
|
||||||
this.toolStripProgressBar2.Name = "toolStripProgressBar2";
|
this.toolStripProgressBar2.Name = "toolStripProgressBar2";
|
||||||
|
this.toolStripProgressBar2.Overflow = System.Windows.Forms.ToolStripItemOverflow.Never;
|
||||||
resources.ApplyResources(this.toolStripProgressBar2, "toolStripProgressBar2");
|
resources.ApplyResources(this.toolStripProgressBar2, "toolStripProgressBar2");
|
||||||
this.toolStripProgressBar2.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
this.toolStripProgressBar2.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -973,19 +973,6 @@ namespace JDP
|
|||||||
entry.Metadata.CopyMetadata(dlg.ChosenRelease.metadata);
|
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();
|
dlg.Close();
|
||||||
}
|
}
|
||||||
else if (_profile._config.advanced.CacheMetadata)
|
else if (_profile._config.advanced.CacheMetadata)
|
||||||
@@ -1006,6 +993,8 @@ namespace JDP
|
|||||||
if (dlgRes == DialogResult.Cancel)
|
if (dlgRes == DialogResult.Cancel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
cueSheet.LoadAndResizeAlbumArt();
|
||||||
|
|
||||||
cueSheet.GenerateFilenames(audioEncoderType, outputFormat, pathOut);
|
cueSheet.GenerateFilenames(audioEncoderType, outputFormat, pathOut);
|
||||||
|
|
||||||
List<string> outputExists = cueSheet.OutputExists();
|
List<string> outputExists = cueSheet.OutputExists();
|
||||||
@@ -1040,6 +1029,10 @@ namespace JDP
|
|||||||
}
|
}
|
||||||
if (outputExists.Count == 0)
|
if (outputExists.Count == 0)
|
||||||
{
|
{
|
||||||
|
this.Invoke((MethodInvoker)delegate ()
|
||||||
|
{
|
||||||
|
pictureBoxMotd.Image = cueSheet.Cover ?? motdImage;
|
||||||
|
});
|
||||||
cueSheet.UsePregapForFirstTrackInSingleFile = _usePregapForFirstTrackInSingleFile && !outputAudio;
|
cueSheet.UsePregapForFirstTrackInSingleFile = _usePregapForFirstTrackInSingleFile && !outputAudio;
|
||||||
if (script == null || script.name == "default")
|
if (script == null || script.name == "default")
|
||||||
{
|
{
|
||||||
@@ -1212,7 +1205,7 @@ namespace JDP
|
|||||||
{
|
{
|
||||||
if (e.percent == 0)
|
if (e.percent == 0)
|
||||||
{
|
{
|
||||||
toolStripStatusLabelProcessed.Visible = false;
|
toolStripStatusLabelProcessed.Text = "";
|
||||||
toolStripProgressBar2.ToolTipText = "";
|
toolStripProgressBar2.ToolTipText = "";
|
||||||
}
|
}
|
||||||
else if (e.percent > 0.02)
|
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);
|
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.Text = String.Format("{0}@{1}", toolStripProgressBar2.ToolTipText, speedStr);
|
||||||
toolStripStatusLabelProcessed.Visible = true;
|
|
||||||
}
|
}
|
||||||
toolStripStatusLabel1.Text = e.status.Replace("&", "&&");
|
toolStripStatusLabel1.Text = e.status.Replace("&", "&&");
|
||||||
|
toolStripStatusLabel1.ToolTipText = e.status;
|
||||||
toolStripProgressBar2.Value = Math.Max(0, Math.Min(100, (int)(e.percent * 100)));
|
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;
|
toolStripStatusLabelAR.Enabled = e.cueSheet != null && e.cueSheet.ArVerify != null && e.cueSheet.ArVerify.ARStatus == null;
|
||||||
@@ -1290,7 +1283,7 @@ namespace JDP
|
|||||||
{
|
{
|
||||||
UpdateActions();
|
UpdateActions();
|
||||||
pictureBoxMotd.Image = motdImage;
|
pictureBoxMotd.Image = motdImage;
|
||||||
toolStripStatusLabelProcessed.Visible = false;
|
toolStripStatusLabelProcessed.Text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//rbGapsLeftOut.Visible =
|
//rbGapsLeftOut.Visible =
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -186,9 +186,6 @@ namespace JDP
|
|||||||
ri.metadata.Tracks[i].ISRC = CUE.Metadata.Tracks[i].ISRC;
|
ri.metadata.Tracks[i].ISRC = CUE.Metadata.Tracks[i].ISRC;
|
||||||
}
|
}
|
||||||
CUE.CopyMetadata(ri.metadata);
|
CUE.CopyMetadata(ri.metadata);
|
||||||
|
|
||||||
// TODO: copy album art
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AutoResizeList(ListView list, int mainCol)
|
private void AutoResizeList(ListView list, int mainCol)
|
||||||
@@ -260,11 +257,23 @@ namespace JDP
|
|||||||
pictureBox1.Image = null;
|
pictureBox1.Image = null;
|
||||||
}
|
}
|
||||||
pictureBox1.ImageLocation = null;
|
pictureBox1.ImageLocation = null;
|
||||||
if (r.metadata.AlbumArt.Count > 0)
|
if (r.metadata.AlbumArt.Count > 0 || r.cover != null)
|
||||||
{
|
{
|
||||||
pictureBox1.Show();
|
pictureBox1.Show();
|
||||||
var image = r.metadata.AlbumArt.Find(x => x.primary) ?? r.metadata.AlbumArt[0];
|
if (r.cover != null)
|
||||||
pictureBox1.ImageLocation = image.uri150;
|
{
|
||||||
|
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
|
} else
|
||||||
{
|
{
|
||||||
pictureBox1.Hide();
|
pictureBox1.Hide();
|
||||||
|
|||||||
2
ThirdParty/taglib-sharp
vendored
2
ThirdParty/taglib-sharp
vendored
Submodule ThirdParty/taglib-sharp updated: 2cab612c54...0443b96585
Reference in New Issue
Block a user