mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-20 18:02:44 +01:00
Fixed: Images for some movies not downloading
Closes #8006 Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
feff609685
commit
248ac9619c
@ -7,9 +7,11 @@ function findImage(images, coverType) {
|
||||
}
|
||||
|
||||
function getUrl(image, coverType, size) {
|
||||
if (image) {
|
||||
const imageUrl = image?.url ?? image?.remoteUrl;
|
||||
|
||||
if (imageUrl) {
|
||||
// Remove protocol
|
||||
let url = image.url.replace(/^https?:/, '');
|
||||
let url = imageUrl.replace(/^https?:/, '');
|
||||
url = url.replace(`${coverType}.jpg`, `${coverType}-${size}.jpg`);
|
||||
|
||||
return url;
|
||||
|
@ -0,0 +1,16 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(231)]
|
||||
public class update_images_remote_url : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Execute.Sql("UPDATE \"MovieMetadata\" SET \"Images\" = REPLACE(\"Images\", '\"url\"', '\"remoteUrl\"')");
|
||||
Execute.Sql("UPDATE \"Credits\" SET \"Images\" = REPLACE(\"Images\", '\"url\"', '\"remoteUrl\"')");
|
||||
Execute.Sql("UPDATE \"Collections\" SET \"Images\" = REPLACE(\"Images\", '\"url\"', '\"remoteUrl\"')");
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
@ -18,15 +17,12 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Roksbox
|
||||
public class RoksboxMetadata : MetadataBase<RoksboxMetadataSettings>
|
||||
{
|
||||
private readonly IMapCoversToLocal _mediaCoverService;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public RoksboxMetadata(IMapCoversToLocal mediaCoverService,
|
||||
IDiskProvider diskProvider,
|
||||
Logger logger)
|
||||
{
|
||||
_mediaCoverService = mediaCoverService;
|
||||
_diskProvider = diskProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
@ -18,15 +17,12 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Wdtv
|
||||
public class WdtvMetadata : MetadataBase<WdtvMetadataSettings>
|
||||
{
|
||||
private readonly IMapCoversToLocal _mediaCoverService;
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public WdtvMetadata(IMapCoversToLocal mediaCoverService,
|
||||
IDiskProvider diskProvider,
|
||||
Logger logger)
|
||||
{
|
||||
_mediaCoverService = mediaCoverService;
|
||||
_diskProvider = diskProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
@ -208,14 +208,14 @@ public override MetadataFileResult MovieMetadata(Movie movie, MovieFile movieFil
|
||||
|
||||
if (thumbnail != null)
|
||||
{
|
||||
details.Add(new XElement("thumb", thumbnail.Url));
|
||||
details.Add(new XElement("thumb", thumbnail.RemoteUrl));
|
||||
}
|
||||
|
||||
foreach (var poster in posters)
|
||||
{
|
||||
if (poster != null && poster.Url != null)
|
||||
if (poster != null && poster.RemoteUrl != null)
|
||||
{
|
||||
details.Add(new XElement("thumb", new XAttribute("aspect", "poster"), new XAttribute("preview", poster.Url), poster.Url));
|
||||
details.Add(new XElement("thumb", new XAttribute("aspect", "poster"), new XAttribute("preview", poster.RemoteUrl), poster.RemoteUrl));
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,9 +224,9 @@ public override MetadataFileResult MovieMetadata(Movie movie, MovieFile movieFil
|
||||
var fanartElement = new XElement("fanart");
|
||||
foreach (var fanart in fanarts)
|
||||
{
|
||||
if (fanart != null && fanart.Url != null)
|
||||
if (fanart != null && fanart.RemoteUrl != null)
|
||||
{
|
||||
fanartElement.Add(new XElement("thumb", new XAttribute("preview", fanart.Url), fanart.Url));
|
||||
fanartElement.Add(new XElement("thumb", new XAttribute("preview", fanart.RemoteUrl), fanart.RemoteUrl));
|
||||
}
|
||||
}
|
||||
|
||||
@ -366,9 +366,9 @@ public override MetadataFileResult MovieMetadata(Movie movie, MovieFile movieFil
|
||||
|
||||
var headshot = credit.Images.FirstOrDefault(m => m.CoverType == MediaCoverTypes.Headshot);
|
||||
|
||||
if (headshot != null && headshot.Url != null)
|
||||
if (headshot != null && headshot.RemoteUrl != null)
|
||||
{
|
||||
actorElement.Add(new XElement("thumb", headshot.Url));
|
||||
actorElement.Add(new XElement("thumb", headshot.RemoteUrl));
|
||||
}
|
||||
|
||||
details.Add(actorElement);
|
||||
|
@ -141,16 +141,5 @@ protected override void Test(List<ValidationFailure> failures)
|
||||
{
|
||||
failures.AddIfNotNull(_radarrV3Proxy.Test(Settings));
|
||||
}
|
||||
|
||||
private static MediaCover.MediaCover MapImage(MediaCover.MediaCover arg, string baseUrl)
|
||||
{
|
||||
var newImage = new MediaCover.MediaCover
|
||||
{
|
||||
Url = string.Format("{0}{1}", baseUrl, arg.Url),
|
||||
CoverType = arg.CoverType
|
||||
};
|
||||
|
||||
return newImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ public MediaCover()
|
||||
{
|
||||
}
|
||||
|
||||
public MediaCover(MediaCoverTypes coverType, string url)
|
||||
public MediaCover(MediaCoverTypes coverType, string remoteUrl)
|
||||
{
|
||||
CoverType = coverType;
|
||||
Url = url;
|
||||
RemoteUrl = remoteUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,6 @@ public void ConvertToLocalUrls(int movieId, IEnumerable<MediaCover> covers, Dict
|
||||
// Movie isn't in Radarr yet, map via a proxy to circument referrer issues
|
||||
foreach (var mediaCover in covers)
|
||||
{
|
||||
mediaCover.RemoteUrl = mediaCover.Url;
|
||||
mediaCover.Url = _mediaCoverProxy.RegisterUrl(mediaCover.RemoteUrl);
|
||||
}
|
||||
}
|
||||
@ -108,7 +107,6 @@ public void ConvertToLocalUrls(int movieId, IEnumerable<MediaCover> covers, Dict
|
||||
|
||||
var filePath = GetCoverPath(movieId, mediaCover.CoverType);
|
||||
|
||||
mediaCover.RemoteUrl = mediaCover.Url;
|
||||
mediaCover.Url = _configFileProvider.UrlBase + @"/MediaCover/" + movieId + "/" + mediaCover.CoverType.ToString().ToLower() + GetExtension(mediaCover.CoverType);
|
||||
|
||||
FileInfo file;
|
||||
@ -162,7 +160,7 @@ private bool EnsureCovers(Movie movie)
|
||||
|
||||
try
|
||||
{
|
||||
alreadyExists = _coverExistsSpecification.AlreadyExists(cover.Url, fileName);
|
||||
alreadyExists = _coverExistsSpecification.AlreadyExists(cover.RemoteUrl, fileName);
|
||||
|
||||
if (!alreadyExists)
|
||||
{
|
||||
@ -207,8 +205,8 @@ private void DownloadCover(Movie movie, MediaCover cover)
|
||||
{
|
||||
var fileName = GetCoverPath(movie.Id, cover.CoverType);
|
||||
|
||||
_logger.Info("Downloading {0} for {1} {2}", cover.CoverType, movie, cover.Url);
|
||||
_httpClient.DownloadFile(cover.Url, fileName);
|
||||
_logger.Info("Downloading {0} for {1} {2}", cover.CoverType, movie, cover.RemoteUrl);
|
||||
_httpClient.DownloadFile(cover.RemoteUrl, fileName);
|
||||
}
|
||||
|
||||
private void EnsureResizedCovers(Movie movie, MediaCover cover, bool forceResize)
|
||||
|
@ -646,7 +646,7 @@ private static MediaCover.MediaCover MapImage(ImageResource arg)
|
||||
{
|
||||
return new MediaCover.MediaCover
|
||||
{
|
||||
Url = arg.Url,
|
||||
RemoteUrl = arg.Url,
|
||||
CoverType = MapCoverType(arg.CoverType)
|
||||
};
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public override void OnGrab(GrabMessage message)
|
||||
{
|
||||
embed.Thumbnail = new DiscordImage
|
||||
{
|
||||
Url = message.Movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Poster)?.Url
|
||||
Url = message.Movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Poster)?.RemoteUrl
|
||||
};
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ public override void OnGrab(GrabMessage message)
|
||||
{
|
||||
embed.Image = new DiscordImage
|
||||
{
|
||||
Url = message.Movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Fanart)?.Url
|
||||
Url = message.Movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Fanart)?.RemoteUrl
|
||||
};
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ public override void OnDownload(DownloadMessage message)
|
||||
{
|
||||
embed.Thumbnail = new DiscordImage
|
||||
{
|
||||
Url = message.Movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Poster)?.Url
|
||||
Url = message.Movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Poster)?.RemoteUrl
|
||||
};
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ public override void OnDownload(DownloadMessage message)
|
||||
{
|
||||
embed.Image = new DiscordImage
|
||||
{
|
||||
Url = message.Movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Fanart)?.Url
|
||||
Url = message.Movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Fanart)?.RemoteUrl
|
||||
};
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ public override void OnManualInteractionRequired(ManualInteractionRequiredMessag
|
||||
{
|
||||
embed.Thumbnail = new DiscordImage
|
||||
{
|
||||
Url = movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Poster)?.Url
|
||||
Url = movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Poster)?.RemoteUrl
|
||||
};
|
||||
}
|
||||
|
||||
@ -454,7 +454,7 @@ public override void OnManualInteractionRequired(ManualInteractionRequiredMessag
|
||||
{
|
||||
embed.Image = new DiscordImage
|
||||
{
|
||||
Url = movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Fanart)?.Url
|
||||
Url = movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Fanart)?.RemoteUrl
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ private void SendNotification(string title, string message, Movie movie)
|
||||
|
||||
if (Settings.IncludeMoviePoster && movie != null)
|
||||
{
|
||||
var poster = movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Poster)?.Url;
|
||||
var poster = movie.MovieMetadata.Value.Images.FirstOrDefault(x => x.CoverType == MediaCoverTypes.Poster)?.RemoteUrl;
|
||||
|
||||
if (poster != null)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ private IEnumerable<ImportListMoviesResource> MapToResource(IEnumerable<Movie> m
|
||||
var poster = currentMovie.MovieMetadata.Value.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
||||
if (poster != null)
|
||||
{
|
||||
resource.RemotePoster = poster.Url;
|
||||
resource.RemotePoster = poster.RemoteUrl;
|
||||
}
|
||||
|
||||
var translation = currentMovie.MovieMetadata.Value.Translations.FirstOrDefault(t => t.Language == language);
|
||||
@ -153,7 +153,7 @@ private IEnumerable<ImportListMoviesResource> MapToResource(IEnumerable<ImportLi
|
||||
var poster = currentMovie.MovieMetadata.Value.Images.FirstOrDefault(c => c.CoverType == MediaCoverTypes.Poster);
|
||||
if (poster != null)
|
||||
{
|
||||
resource.RemotePoster = poster.Url;
|
||||
resource.RemotePoster = poster.RemoteUrl;
|
||||
}
|
||||
|
||||
var translation = GetTranslationFromDictionary(translations, currentMovie.MovieMetadata, language);
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
@ -114,7 +115,7 @@ public static MovieResource ToResource(this Movie model, int availDelay, MovieTr
|
||||
Status = model.MovieMetadata.Value.Status,
|
||||
Overview = translatedOverview,
|
||||
|
||||
Images = model.MovieMetadata.Value.Images,
|
||||
Images = model.MovieMetadata.Value.Images.JsonClone(),
|
||||
|
||||
Year = model.Year,
|
||||
SecondaryYear = model.MovieMetadata.Value.SecondaryYear,
|
||||
|
Loading…
Reference in New Issue
Block a user