Crop, rotate and trim album art

This commit is contained in:
Grigory Chudov
2018-07-03 19:59:19 -04:00
parent 53dadd858a
commit dd1358f8dc
5 changed files with 703 additions and 521 deletions

View File

@@ -557,6 +557,7 @@ namespace JDP
this.Invoke((MethodInvoker)delegate()
{
frmChoice dlg = new frmChoice();
dlg.config = _profile._config;
if (_choiceWidth != 0 && _choiceHeight != 0)
dlg.Size = new Size(_choiceWidth, _choiceHeight);
if (_choiceMaxed)
@@ -941,6 +942,7 @@ namespace JDP
if (_batchPaths.Count <= 1 && _batchProcessed == 0 && action == CUEAction.Encode && checkBoxEditTags.Checked)
{
frmChoice dlg = new frmChoice();
dlg.config = _profile._config;
if (_choiceWidth != 0 && _choiceHeight != 0)
dlg.Size = new Size(_choiceWidth, _choiceHeight);
if (_choiceMaxed)
@@ -971,6 +973,19 @@ 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)
@@ -2238,6 +2253,7 @@ namespace JDP
}
CueSheet.UseLocalDB(_localDB);
frmChoice dlg = new frmChoice();
dlg.config = _profile._config;
if (_choiceWidth != 0 && _choiceHeight != 0)
dlg.Size = new Size(_choiceWidth, _choiceHeight);
if (_choiceMaxed)