mirror of https://github.com/lidarr/Lidarr
New: Option to disable cover art embed in files (#4547)
* New: Option to disable cover art embed in files Fixes #2488 * Update src/NzbDrone.Core/MediaFiles/AudioTagService.cs Co-authored-by: Bogdan <mynameisbogdan@users.noreply.github.com>
This commit is contained in:
parent
3702fa773c
commit
d38c44d25e
|
@ -61,6 +61,23 @@ function MetadataProvider(props) {
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
{
|
||||||
|
settings.writeAudioTags.value !== 'no' &&
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>
|
||||||
|
{translate('EmbedCoverArtInAudioFiles')}
|
||||||
|
</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="embedCoverArt"
|
||||||
|
helpText={translate('EmbedCoverArtHelpText')}
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.embedCoverArt}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
}
|
||||||
|
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormLabel>
|
<FormLabel>
|
||||||
{translate('ScrubExistingTags')}
|
{translate('ScrubExistingTags')}
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace Lidarr.Api.V1.Config
|
||||||
public string MetadataSource { get; set; }
|
public string MetadataSource { get; set; }
|
||||||
public WriteAudioTagsType WriteAudioTags { get; set; }
|
public WriteAudioTagsType WriteAudioTags { get; set; }
|
||||||
public bool ScrubAudioTags { get; set; }
|
public bool ScrubAudioTags { get; set; }
|
||||||
|
public bool EmbedCoverArt { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MetadataProviderConfigResourceMapper
|
public static class MetadataProviderConfigResourceMapper
|
||||||
|
@ -19,6 +20,7 @@ namespace Lidarr.Api.V1.Config
|
||||||
MetadataSource = model.MetadataSource,
|
MetadataSource = model.MetadataSource,
|
||||||
WriteAudioTags = model.WriteAudioTags,
|
WriteAudioTags = model.WriteAudioTags,
|
||||||
ScrubAudioTags = model.ScrubAudioTags,
|
ScrubAudioTags = model.ScrubAudioTags,
|
||||||
|
EmbedCoverArt = model.EmbedCoverArt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,10 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
||||||
.Setup(x => x.WriteAudioTags)
|
.Setup(x => x.WriteAudioTags)
|
||||||
.Returns(WriteAudioTagsType.Sync);
|
.Returns(WriteAudioTagsType.Sync);
|
||||||
|
|
||||||
|
Mocker.GetMock<IConfigService>()
|
||||||
|
.Setup(x => x.EmbedCoverArt)
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
var imageFile = Path.Combine(_testdir, "nin.png");
|
var imageFile = Path.Combine(_testdir, "nin.png");
|
||||||
var imageSize = _diskProvider.GetFileSize(imageFile);
|
var imageSize = _diskProvider.GetFileSize(imageFile);
|
||||||
|
|
||||||
|
|
|
@ -283,6 +283,13 @@ namespace NzbDrone.Core.Configuration
|
||||||
set { SetValue("ScrubAudioTags", value); }
|
set { SetValue("ScrubAudioTags", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool EmbedCoverArt
|
||||||
|
{
|
||||||
|
get { return GetValueBoolean("EmbedCoverArt", true); }
|
||||||
|
|
||||||
|
set { SetValue("EmbedCoverArt", value); }
|
||||||
|
}
|
||||||
|
|
||||||
public int FirstDayOfWeek
|
public int FirstDayOfWeek
|
||||||
{
|
{
|
||||||
get { return GetValueInt("FirstDayOfWeek", (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek); }
|
get { return GetValueInt("FirstDayOfWeek", (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek); }
|
||||||
|
|
|
@ -76,6 +76,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
string MetadataSource { get; set; }
|
string MetadataSource { get; set; }
|
||||||
WriteAudioTagsType WriteAudioTags { get; set; }
|
WriteAudioTagsType WriteAudioTags { get; set; }
|
||||||
bool ScrubAudioTags { get; set; }
|
bool ScrubAudioTags { get; set; }
|
||||||
|
bool EmbedCoverArt { get; set; }
|
||||||
|
|
||||||
// Forms Auth
|
// Forms Auth
|
||||||
string RijndaelPassphrase { get; }
|
string RijndaelPassphrase { get; }
|
||||||
|
|
|
@ -402,6 +402,8 @@
|
||||||
"EditSelectedDownloadClients": "Edit Selected Download Clients",
|
"EditSelectedDownloadClients": "Edit Selected Download Clients",
|
||||||
"EditSelectedImportLists": "Edit Selected Import Lists",
|
"EditSelectedImportLists": "Edit Selected Import Lists",
|
||||||
"EditSelectedIndexers": "Edit Selected Indexers",
|
"EditSelectedIndexers": "Edit Selected Indexers",
|
||||||
|
"EmbedCoverArtInAudioFiles": "Embed Cover Art In Audio Files",
|
||||||
|
"EmbedCoverArtHelpText": "Embed Lidarr album art into audio files when writing tags",
|
||||||
"Enable": "Enable",
|
"Enable": "Enable",
|
||||||
"EnableAutomaticAdd": "Enable Automatic Add",
|
"EnableAutomaticAdd": "Enable Automatic Add",
|
||||||
"EnableAutomaticAddHelpText": "Add artist/albums to {appName} when syncs are performed via the UI or by {appName}",
|
"EnableAutomaticAddHelpText": "Add artist/albums to {appName} when syncs are performed via the UI or by {appName}",
|
||||||
|
|
|
@ -80,21 +80,25 @@ namespace NzbDrone.Core.MediaFiles
|
||||||
var albumartist = album.Artist.Value;
|
var albumartist = album.Artist.Value;
|
||||||
var artist = track.ArtistMetadata.Value;
|
var artist = track.ArtistMetadata.Value;
|
||||||
|
|
||||||
var cover = album.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Cover);
|
|
||||||
string imageFile = null;
|
string imageFile = null;
|
||||||
long imageSize = 0;
|
long imageSize = 0;
|
||||||
if (cover != null)
|
|
||||||
|
if (_configService.EmbedCoverArt)
|
||||||
{
|
{
|
||||||
imageFile = _mediaCoverService.GetCoverPath(album.Id, MediaCoverEntity.Album, cover.CoverType, cover.Extension, null);
|
var cover = album.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Cover);
|
||||||
_logger.Trace($"Embedding: {imageFile}");
|
if (cover != null)
|
||||||
var fileInfo = _diskProvider.GetFileInfo(imageFile);
|
|
||||||
if (fileInfo.Exists)
|
|
||||||
{
|
{
|
||||||
imageSize = fileInfo.Length;
|
imageFile = _mediaCoverService.GetCoverPath(album.Id, MediaCoverEntity.Album, cover.CoverType, cover.Extension, null);
|
||||||
}
|
_logger.Trace("Embedding: {0}", imageFile);
|
||||||
else
|
var fileInfo = _diskProvider.GetFileInfo(imageFile);
|
||||||
{
|
if (fileInfo.Exists)
|
||||||
imageFile = null;
|
{
|
||||||
|
imageSize = fileInfo.Length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
imageFile = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue