mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 20:12:41 +02:00
Rename Clearart to Clearlogo, use png for Clearlogo
(cherry picked from commit 349f7cf4c934fbf53516f7e92026282750180a16)
This commit is contained in:
parent
371eb68bf0
commit
7b7b866777
@ -11,7 +11,7 @@ public enum MediaCoverTypes
|
||||
Fanart = 3,
|
||||
Screenshot = 4,
|
||||
Headshot = 5,
|
||||
Clearart = 6
|
||||
Clearlogo = 6
|
||||
}
|
||||
|
||||
public class MediaCover : MemberwiseEquatable<MediaCover>, IEmbeddedDocument
|
||||
|
@ -22,7 +22,7 @@ public interface IMapCoversToLocal
|
||||
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 @@ public MediaCoverService(IMediaCoverProxy mediaCoverProxy,
|
||||
_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 @@ public void ConvertToLocalUrls(int movieId, IEnumerable<MediaCover> covers, Dict
|
||||
{
|
||||
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 @@ private void EnsureResizedCovers(Movie movie, MediaCover cover, bool forceResize
|
||||
}
|
||||
}
|
||||
|
||||
private string GetExtension(MediaCoverTypes coverType)
|
||||
{
|
||||
return coverType switch
|
||||
{
|
||||
MediaCoverTypes.Clearlogo => ".png",
|
||||
_ => ".jpg"
|
||||
};
|
||||
}
|
||||
|
||||
public void HandleAsync(MovieUpdatedEvent message)
|
||||
{
|
||||
var updated = EnsureCovers(message.Movie);
|
||||
|
Loading…
Reference in New Issue
Block a user