mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 13:23:20 -07:00
Merge pull request #3199 from msdeibel/3195_AlbumCoverUrls
Fixes issue #3195
This commit is contained in:
commit
c13958980e
7 changed files with 85 additions and 8 deletions
18
.github/workflows/aspnetcore.yml
vendored
Normal file
18
.github/workflows/aspnetcore.yml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
name: ASP.NET Core CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Setup .NET Core
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: 2.2.108
|
||||
|
||||
- name: Build Backend
|
||||
run: ./build.sh --settings_skipverification=true
|
9
.github/workflows/test.workflow
vendored
Normal file
9
.github/workflows/test.workflow
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
workflow "New workflow" {
|
||||
on = "push"
|
||||
resolves = [".NET Core CLI"]
|
||||
}
|
||||
|
||||
action ".NET Core CLI" {
|
||||
uses = "baruchiro/github-actions@0.0.1"
|
||||
args = "build src/Ombi.sln"
|
||||
}
|
|
@ -17,6 +17,7 @@ using Ombi.Api.Lidarr.Models;
|
|||
using Ombi.Core.Authentication;
|
||||
using Ombi.Core.Settings;
|
||||
using Ombi.Helpers;
|
||||
using Ombi.Core.Helpers;
|
||||
using Ombi.Settings.Settings.Models;
|
||||
using Ombi.Settings.Settings.Models.External;
|
||||
using Ombi.Store.Entities;
|
||||
|
@ -166,7 +167,7 @@ namespace Ombi.Core.Engine
|
|||
Rating = a.ratings?.value ?? 0m,
|
||||
ReleaseDate = a.releaseDate,
|
||||
Title = a.title,
|
||||
Disk = a.images?.FirstOrDefault(x => x.coverType.Equals("disc"))?.url?.Replace("http", "https"),
|
||||
Disk = a.images?.FirstOrDefault(x => x.coverType.Equals("disc"))?.url?.ToHttpsUrl(),
|
||||
Genres = a.genres,
|
||||
AlbumType = a.albumType,
|
||||
ArtistName = a.artist.artistName,
|
||||
|
@ -187,7 +188,7 @@ namespace Ombi.Core.Engine
|
|||
//vm.ArtistName = a.artist?.artistName;
|
||||
}
|
||||
|
||||
vm.Cover = a.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url?.Replace("http", "https");
|
||||
vm.Cover = a.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url?.ToHttpsUrl();
|
||||
|
||||
await Rules.StartSpecificRules(vm, SpecificRules.LidarrAlbum);
|
||||
|
||||
|
@ -205,7 +206,7 @@ namespace Ombi.Core.Engine
|
|||
Rating = a.ratings?.value ?? 0m,
|
||||
ReleaseDate = a.releaseDate,
|
||||
Title = a.title,
|
||||
Disk = a.images?.FirstOrDefault(x => x.coverType.Equals("disc"))?.url?.Replace("http", "https"),
|
||||
Disk = a.images?.FirstOrDefault(x => x.coverType.Equals("disc"))?.url?.ToHttpsUrl(),
|
||||
Genres = a.genres
|
||||
};
|
||||
if (a.artistId > 0)
|
||||
|
@ -223,7 +224,7 @@ namespace Ombi.Core.Engine
|
|||
vm.ArtistName = a.artist?.artistName;
|
||||
}
|
||||
|
||||
vm.Cover = a.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url?.Replace("http", "https");
|
||||
vm.Cover = a.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url?.ToHttpsUrl();
|
||||
if (vm.Cover.IsNullOrEmpty())
|
||||
{
|
||||
vm.Cover = a.remoteCover;
|
||||
|
|
44
src/Ombi.Helpers.Tests/StringHelperTests.cs
Normal file
44
src/Ombi.Helpers.Tests/StringHelperTests.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using NUnit.Framework;
|
||||
|
||||
namespace Ombi.Helpers.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class StringHelperTests
|
||||
{
|
||||
[Test]
|
||||
public void ToHttpsUrl_ShouldReturnsHttpsUrl_HttpUrl()
|
||||
{
|
||||
var sourceUrl = "http://www.test.url";
|
||||
var expectedUrl = "https://www.test.url";
|
||||
|
||||
Assert.AreEqual(expectedUrl, sourceUrl.ToHttpsUrl(), "Should return the source URL as https");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToHttpsUrl_ShouldReturnsUnchangedUrl_HttpsUrl()
|
||||
{
|
||||
var sourceUrl = "https://www.test.url";
|
||||
var expectedUrl = "https://www.test.url";
|
||||
|
||||
Assert.AreEqual(expectedUrl, sourceUrl.ToHttpsUrl(), "Should return the unchanged https URL");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToHttpsUrl_ShouldReturnsUnchangedUrl_NonHttpUrl()
|
||||
{
|
||||
var sourceUrl = "ftp://www.test.url";
|
||||
var expectedUrl = "ftp://www.test.url";
|
||||
|
||||
Assert.AreEqual(expectedUrl, sourceUrl.ToHttpsUrl(), "Should return the unchanged non-http URL");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToHttpsUrl_ShouldReturnsUnchangedUrl_InvalidUrl()
|
||||
{
|
||||
var sourceUrl = "http:/www.test.url";
|
||||
var expectedUrl = "http:/www.test.url";
|
||||
|
||||
Assert.AreEqual(expectedUrl, sourceUrl.ToHttpsUrl(), "Should return the unchanged invalid URL");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -128,5 +128,10 @@ namespace Ombi.Helpers
|
|||
{
|
||||
return string.Concat(str.Where(c => !chars.Contains(c)));
|
||||
}
|
||||
|
||||
public static string ToHttpsUrl(this string currentUrl)
|
||||
{
|
||||
return currentUrl.Replace("http://", "https://");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ namespace Ombi.Mapping.Profiles
|
|||
.ForMember(dest => dest.Runtime, opts => opts.MapFrom(src => src.show.runtime.ToString()))
|
||||
.ForMember(dest => dest.SeriesId, opts => opts.MapFrom(src => src.show.id))
|
||||
.ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.show.name))
|
||||
.ForMember(dest => dest.Banner, opts => opts.MapFrom(src => !string.IsNullOrEmpty(src.show.image.medium) ? src.show.image.medium.Replace("http", "https") : string.Empty))
|
||||
.ForMember(dest => dest.Banner, opts => opts.MapFrom(src => !string.IsNullOrEmpty(src.show.image.medium) ? src.show.image.medium.ToHttpsUrl() : string.Empty))
|
||||
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.show.status));
|
||||
|
||||
CreateMap<TvMazeShow, SearchTvShowViewModel>()
|
||||
|
@ -46,7 +46,7 @@ namespace Ombi.Mapping.Profiles
|
|||
.ForMember(dest => dest.Title, opts => opts.MapFrom(src => src.name))
|
||||
.ForMember(dest => dest.Banner,
|
||||
opts => opts.MapFrom(src => !string.IsNullOrEmpty(src.image.medium)
|
||||
? src.image.medium.Replace("http", "https")
|
||||
? src.image.medium.ToHttpsUrl()
|
||||
: string.Empty))
|
||||
.ForMember(dest => dest.Status, opts => opts.MapFrom(src => src.status));
|
||||
|
||||
|
|
|
@ -682,7 +682,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|||
var banner = info.image?.original;
|
||||
if (!string.IsNullOrEmpty(banner))
|
||||
{
|
||||
banner = banner.Replace("http", "https"); // Always use the Https banners
|
||||
banner = banner.ToHttpsUrl(); // Always use the Https banners
|
||||
}
|
||||
|
||||
var tvInfo = await _movieApi.GetTVInfo(t.TheMovieDbId);
|
||||
|
@ -804,7 +804,7 @@ namespace Ombi.Schedule.Jobs.Ombi
|
|||
var banner = info.image?.original;
|
||||
if (!string.IsNullOrEmpty(banner))
|
||||
{
|
||||
banner = banner.Replace("http", "https"); // Always use the Https banners
|
||||
banner = banner.ToHttpsUrl(); // Always use the Https banners
|
||||
}
|
||||
|
||||
var tvInfo = await _movieApi.GetTVInfo(t.TheMovieDbId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue