Rename Clearart to Clearlogo, use png for Clearlogo

(cherry picked from commit 349f7cf4c934fbf53516f7e92026282750180a16)
pull/8583/head
Mark McDowall 1 year ago committed by Bogdan
parent 371eb68bf0
commit 7b7b866777

@ -11,7 +11,7 @@ namespace NzbDrone.Core.MediaCover
Fanart = 3,
Screenshot = 4,
Headshot = 5,
Clearart = 6
Clearlogo = 6
}
public class MediaCover : MemberwiseEquatable<MediaCover>, IEmbeddedDocument

@ -22,7 +22,7 @@ namespace NzbDrone.Core.MediaCover
Dictionary<string, FileInfo> GetCoverFileInfos();
void ConvertToLocalUrls(int movieId, IEnumerable<MediaCover> covers, Dictionary<string, FileInfo> fileInfos = null);
void ConvertToLocalUrls(IEnumerable<Tuple<int, IEnumerable<MediaCover>>> items, Dictionary<string, FileInfo> coverFileInfos);
string GetCoverPath(int movieId, MediaCoverTypes mediaCoverTypes, int? height = null);
string GetCoverPath(int movieId, MediaCoverTypes coverType, int? height = null);
}
public class MediaCoverService :
@ -67,11 +67,11 @@ namespace NzbDrone.Core.MediaCover
_coverRootFolder = appFolderInfo.GetMediaCoverPath();
}
public string GetCoverPath(int movieId, MediaCoverTypes coverTypes, int? height = null)
public string GetCoverPath(int movieId, MediaCoverTypes coverType, int? height = null)
{
var heightSuffix = height.HasValue ? "-" + height.ToString() : "";
return Path.Combine(GetMovieCoverPath(movieId), coverTypes.ToString().ToLower() + heightSuffix + ".jpg");
return Path.Combine(GetMovieCoverPath(movieId), coverType.ToString().ToLower() + heightSuffix + GetExtension(coverType));
}
public Dictionary<string, FileInfo> GetCoverFileInfos()
@ -101,10 +101,15 @@ namespace NzbDrone.Core.MediaCover
{
foreach (var mediaCover in covers)
{
if (mediaCover.CoverType == MediaCoverTypes.Unknown)
{
continue;
}
var filePath = GetCoverPath(movieId, mediaCover.CoverType);
mediaCover.RemoteUrl = mediaCover.Url;
mediaCover.Url = _configFileProvider.UrlBase + @"/MediaCover/" + movieId + "/" + mediaCover.CoverType.ToString().ToLower() + ".jpg";
mediaCover.Url = _configFileProvider.UrlBase + @"/MediaCover/" + movieId + "/" + mediaCover.CoverType.ToString().ToLower() + GetExtension(mediaCover.CoverType);
FileInfo file;
var fileExists = false;
@ -251,6 +256,15 @@ namespace NzbDrone.Core.MediaCover
}
}
private string GetExtension(MediaCoverTypes coverType)
{
return coverType switch
{
MediaCoverTypes.Clearlogo => ".png",
_ => ".jpg"
};
}
public void HandleAsync(MovieUpdatedEvent message)
{
var updated = EnsureCovers(message.Movie);

Loading…
Cancel
Save