mirror of
https://github.com/Sonarr/Sonarr
synced 2025-12-06 08:28:37 +01:00
Compare commits
8 commits
v4.0.15.29
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
52972e7efc | ||
|
|
8c50919499 | ||
|
|
fdc07a47b1 | ||
|
|
36225c3709 | ||
|
|
bc037ae356 | ||
|
|
77a335de30 | ||
|
|
88d56361c4 | ||
|
|
d10107739b |
10 changed files with 259 additions and 208 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
|
@ -22,7 +22,7 @@ env:
|
|||
FRAMEWORK: net6.0
|
||||
RAW_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||
SONARR_MAJOR_VERSION: 4
|
||||
VERSION: 4.0.15
|
||||
VERSION: 4.0.16
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
.modal {
|
||||
position: relative;
|
||||
display: flex;
|
||||
max-width: 90%;
|
||||
max-height: 90%;
|
||||
border-radius: 6px;
|
||||
opacity: 1;
|
||||
|
|
|
|||
|
|
@ -390,5 +390,12 @@ public virtual HttpRequestBuilder AddFormUpload(string name, string fileName, by
|
|||
|
||||
return this;
|
||||
}
|
||||
|
||||
public virtual HttpRequestBuilder AllowRedirect(bool allowAutoRedirect = true)
|
||||
{
|
||||
AllowAutoRedirect = allowAutoRedirect;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
9
src/NzbDrone.Common/Utf8StringWriter.cs
Normal file
9
src/NzbDrone.Common/Utf8StringWriter.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Common;
|
||||
|
||||
public class Utf8StringWriter : StringWriter
|
||||
{
|
||||
public override Encoding Encoding => Encoding.UTF8;
|
||||
}
|
||||
|
|
@ -213,5 +213,16 @@ public void should_use_runtime_from_episode_over_series()
|
|||
|
||||
Subject.IsSample(_localEpisode).Should().Be(DetectSampleResult.Sample);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_default_to_45_minutes_if_runtime_is_zero()
|
||||
{
|
||||
GivenRuntime(120);
|
||||
|
||||
_localEpisode.Series.Runtime = 0;
|
||||
_localEpisode.Episodes.First().Runtime = 0;
|
||||
|
||||
Subject.IsSample(_localEpisode).Should().Be(DetectSampleResult.Sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -425,8 +425,8 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
|
|||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
_logger.Debug("qbitTorrent authentication failed.");
|
||||
if (ex.Response.StatusCode == HttpStatusCode.Forbidden)
|
||||
_logger.Debug(ex, "qbitTorrent authentication failed.");
|
||||
if (ex.Response.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
|
||||
{
|
||||
throw new DownloadClientAuthenticationException("Failed to authenticate with qBittorrent.", ex);
|
||||
}
|
||||
|
|
@ -438,7 +438,7 @@ private void AuthenticateClient(HttpRequestBuilder requestBuilder, QBittorrentSe
|
|||
throw new DownloadClientUnavailableException("Failed to connect to qBittorrent, please check your settings.", ex);
|
||||
}
|
||||
|
||||
if (response.Content != "Ok.")
|
||||
if (response.Content.IsNotNullOrWhiteSpace() && response.Content != "Ok.")
|
||||
{
|
||||
// returns "Fails." on bad login
|
||||
_logger.Debug("qbitTorrent authentication failed.");
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Serializer;
|
||||
|
|
@ -149,13 +150,7 @@ public override MetadataFileResult SeriesMetadata(Series series, SeriesMetadataR
|
|||
if (Settings.SeriesMetadata)
|
||||
{
|
||||
_logger.Debug("Generating Series Metadata for: {0}", series.Title);
|
||||
var sb = new StringBuilder();
|
||||
var xws = new XmlWriterSettings();
|
||||
xws.OmitXmlDeclaration = true;
|
||||
xws.Indent = false;
|
||||
|
||||
using (var xw = XmlWriter.Create(sb, xws))
|
||||
{
|
||||
var tvShow = new XElement("tvshow");
|
||||
|
||||
tvShow.Add(new XElement("title", series.Title));
|
||||
|
|
@ -248,11 +243,23 @@ public override MetadataFileResult SeriesMetadata(Series series, SeriesMetadataR
|
|||
tvShow.Add(new XElement("episodeguide", JsonSerializer.Serialize(episodeGuide, serializerSettings)));
|
||||
}
|
||||
|
||||
var doc = new XDocument(tvShow);
|
||||
doc.Save(xw);
|
||||
var doc = new XDocument(tvShow)
|
||||
{
|
||||
Declaration = new XDeclaration("1.0", "UTF-8", "yes"),
|
||||
};
|
||||
|
||||
xmlResult += doc.ToString();
|
||||
}
|
||||
var sb = new StringBuilder();
|
||||
using var sw = new Utf8StringWriter();
|
||||
using var xw = XmlWriter.Create(sw, new XmlWriterSettings
|
||||
{
|
||||
Encoding = Encoding.UTF8,
|
||||
Indent = true
|
||||
});
|
||||
|
||||
doc.Save(xw);
|
||||
xw.Flush();
|
||||
|
||||
xmlResult += sw.ToString();
|
||||
}
|
||||
|
||||
if (Settings.SeriesMetadataUrl)
|
||||
|
|
@ -280,16 +287,19 @@ public override MetadataFileResult EpisodeMetadata(Series series, EpisodeFile ep
|
|||
var watched = GetExistingWatchedStatus(series, episodeFile.RelativePath);
|
||||
|
||||
var xmlResult = string.Empty;
|
||||
var xws = new XmlWriterSettings
|
||||
{
|
||||
Encoding = Encoding.UTF8,
|
||||
Indent = true
|
||||
};
|
||||
|
||||
foreach (var episode in episodeFile.Episodes.Value)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var xws = new XmlWriterSettings();
|
||||
xws.OmitXmlDeclaration = true;
|
||||
xws.Indent = false;
|
||||
|
||||
using (var xw = XmlWriter.Create(sb, xws))
|
||||
var doc = new XDocument
|
||||
{
|
||||
var doc = new XDocument();
|
||||
Declaration = new XDeclaration("1.0", "UTF-8", "yes")
|
||||
};
|
||||
|
||||
var image = episode.Images.SingleOrDefault(i => i.CoverType == MediaCoverTypes.Screenshot);
|
||||
|
||||
var details = new XElement("episodedetails");
|
||||
|
|
@ -381,13 +391,16 @@ public override MetadataFileResult EpisodeMetadata(Series series, EpisodeFile ep
|
|||
// details.Add(new XElement("credits", tvdbEpisode.Writer.FirstOrDefault()));
|
||||
// details.Add(new XElement("director", tvdbEpisode.Directors.FirstOrDefault()));
|
||||
|
||||
using var sw = new Utf8StringWriter();
|
||||
using var xw = XmlWriter.Create(sw, xws);
|
||||
|
||||
doc.Add(details);
|
||||
doc.Save(xw);
|
||||
xw.Flush();
|
||||
|
||||
xmlResult += doc.ToString();
|
||||
xmlResult += sw.ToString();
|
||||
xmlResult += Environment.NewLine;
|
||||
}
|
||||
}
|
||||
|
||||
return new MetadataFileResult(GetEpisodeMetadataFilename(episodeFile.RelativePath), xmlResult.Trim(Environment.NewLine.ToCharArray()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ private List<TResource> Execute<TResource>(CustomSettings settings)
|
|||
}
|
||||
|
||||
var baseUrl = settings.BaseUrl.TrimEnd('/');
|
||||
var request = new HttpRequestBuilder(baseUrl).Accept(HttpAccept.Json).Build();
|
||||
var request = new HttpRequestBuilder(baseUrl).Accept(HttpAccept.Json).AllowRedirect().Build();
|
||||
var response = _httpClient.Get(request);
|
||||
var results = JsonConvert.DeserializeObject<List<TResource>>(response.Content);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,12 @@ public DetectSampleResult IsSample(LocalEpisode localEpisode)
|
|||
return DetectSampleResult.Indeterminate;
|
||||
}
|
||||
|
||||
if (runtime == 0)
|
||||
{
|
||||
_logger.Debug("Series runtime is 0, defaulting runtime to 45 minutes");
|
||||
runtime = 45;
|
||||
}
|
||||
|
||||
return IsSample(localEpisode.Path, localEpisode.MediaInfo.RunTime, runtime);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using DryIoc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
|
|
@ -59,8 +60,11 @@ public void ConfigureServices(IServiceCollection services)
|
|||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto | ForwardedHeaders.XForwardedHost;
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("10.0.0.0"), 8));
|
||||
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("172.16.0.0"), 12));
|
||||
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("192.168.0.0"), 16));
|
||||
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("fc00::"), 7));
|
||||
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("fe80::"), 10));
|
||||
});
|
||||
|
||||
services.AddRouting(options => options.LowercaseUrls = true);
|
||||
|
|
|
|||
Loading…
Reference in a new issue