mirror of https://github.com/Jackett/Jackett
Fixes some invalid torrent files
Sonarr would not accept torrents where the keys were not sorted. This update will sort the keys before sending the file to the downloader to make the torrent valid for Sonarr.
This commit is contained in:
parent
ea6f65e725
commit
c07fc4de44
|
@ -10,6 +10,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using MonoTorrent.BEncoding;
|
||||
|
||||
namespace Jackett.Controllers
|
||||
{
|
||||
|
@ -51,6 +52,10 @@ namespace Jackett.Controllers
|
|||
|
||||
var downloadBytes = await indexer.Download(target);
|
||||
|
||||
// This will fix torrents where the keys are not sorted, and thereby not supported by Sonarr.
|
||||
var torrentDictionary = BEncodedDictionary.DecodeTorrent(downloadBytes);
|
||||
downloadBytes = torrentDictionary.Encode();
|
||||
|
||||
var result = new HttpResponseMessage(HttpStatusCode.OK);
|
||||
result.Content = new ByteArrayContent(downloadBytes);
|
||||
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-bittorrent");
|
||||
|
|
|
@ -110,6 +110,10 @@
|
|||
<HintPath>..\packages\Microsoft.Owin.StaticFiles.3.0.1\lib\net45\Microsoft.Owin.StaticFiles.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MonoTorrent, Version=0.80.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MonoTorrent.0.9.0\lib\net20\MonoTorrent.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net45" />
|
||||
<package id="MonoTorrent" version="0.9.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net45" />
|
||||
<package id="NLog.Windows.Forms" version="2.0.0.0" targetFramework="net45" />
|
||||
|
|
Loading…
Reference in New Issue