mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: (FileList) Add alternative URL and return only FL results when fl-only is set
This commit is contained in:
@@ -8,7 +8,7 @@ using Moq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.FileList;
|
using NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
@@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Indexers.FileList;
|
using NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
|
@@ -3,12 +3,16 @@ using NLog;
|
|||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.FileList
|
namespace NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
|
|
||||||
|
public class FileList : TorrentIndexerBase<FileListSettings>
|
||||||
{
|
{
|
||||||
public class FileList : TorrentIndexerBase<FileListSettings>
|
|
||||||
{
|
|
||||||
public override string Name => "FileList.io";
|
public override string Name => "FileList.io";
|
||||||
public override string[] IndexerUrls => new[] { "https://filelist.io/" };
|
public override string[] IndexerUrls => new[]
|
||||||
|
{
|
||||||
|
"https://filelist.io/",
|
||||||
|
"https://flro.org/"
|
||||||
|
};
|
||||||
public override string[] LegacyUrls => new[] { "https://filelist.io" };
|
public override string[] LegacyUrls => new[] { "https://filelist.io" };
|
||||||
public override string Description => "FileList (FL) is a ROMANIAN Private Torrent Tracker for 0DAY / GENERAL";
|
public override string Description => "FileList (FL) is a ROMANIAN Private Torrent Tracker for 0DAY / GENERAL";
|
||||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||||
@@ -93,5 +97,4 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.FileList
|
namespace NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
|
|
||||||
|
public class FileListTorrent
|
||||||
{
|
{
|
||||||
public class FileListTorrent
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
@@ -25,5 +25,4 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
public string Category { get; set; }
|
public string Category { get; set; }
|
||||||
[JsonProperty(PropertyName = "small_description")]
|
[JsonProperty(PropertyName = "small_description")]
|
||||||
public string SmallDescription { get; set; }
|
public string SmallDescription { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -8,10 +8,10 @@ using NzbDrone.Common.Http;
|
|||||||
using NzbDrone.Core.Indexers.Exceptions;
|
using NzbDrone.Core.Indexers.Exceptions;
|
||||||
using NzbDrone.Core.Parser.Model;
|
using NzbDrone.Core.Parser.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.FileList
|
namespace NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
|
|
||||||
|
public class FileListParser : IParseIndexerResponse
|
||||||
{
|
{
|
||||||
public class FileListParser : IParseIndexerResponse
|
|
||||||
{
|
|
||||||
private readonly FileListSettings _settings;
|
private readonly FileListSettings _settings;
|
||||||
private readonly IndexerCapabilitiesCategories _categories;
|
private readonly IndexerCapabilitiesCategories _categories;
|
||||||
|
|
||||||
@@ -23,8 +23,6 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
|
|
||||||
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||||
{
|
{
|
||||||
var torrentInfos = new List<ReleaseInfo>();
|
|
||||||
|
|
||||||
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
throw new IndexerException(indexerResponse, "Unexpected response status {0} code from API request", indexerResponse.HttpResponse.StatusCode);
|
throw new IndexerException(indexerResponse, "Unexpected response status {0} code from API request", indexerResponse.HttpResponse.StatusCode);
|
||||||
@@ -35,45 +33,52 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
throw new IndexerException(indexerResponse, $"Unexpected response header {indexerResponse.HttpResponse.Headers.ContentType} from API request, expected {HttpAccept.Json.Value}");
|
throw new IndexerException(indexerResponse, $"Unexpected response header {indexerResponse.HttpResponse.Headers.ContentType} from API request, expected {HttpAccept.Json.Value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
var queryResults = JsonConvert.DeserializeObject<List<FileListTorrent>>(indexerResponse.Content);
|
var releaseInfos = new List<ReleaseInfo>();
|
||||||
|
|
||||||
foreach (var result in queryResults)
|
var results = JsonConvert.DeserializeObject<List<FileListTorrent>>(indexerResponse.Content);
|
||||||
|
|
||||||
|
foreach (var row in results)
|
||||||
{
|
{
|
||||||
var id = result.Id;
|
// skip non-freeleech results when freeleech only is set
|
||||||
|
if (_settings.FreeleechOnly && !row.FreeLeech)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var id = row.Id;
|
||||||
|
|
||||||
var flags = new HashSet<IndexerFlag>();
|
var flags = new HashSet<IndexerFlag>();
|
||||||
|
if (row.Internal)
|
||||||
if (result.Internal)
|
|
||||||
{
|
{
|
||||||
flags.Add(IndexerFlag.Internal);
|
flags.Add(IndexerFlag.Internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
var imdbId = 0;
|
var imdbId = 0;
|
||||||
if (result.ImdbId != null && result.ImdbId.Length > 2)
|
if (row.ImdbId != null && row.ImdbId.Length > 2)
|
||||||
{
|
{
|
||||||
imdbId = int.Parse(result.ImdbId.Substring(2));
|
imdbId = int.Parse(row.ImdbId.Substring(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
var downloadVolumeFactor = result.FreeLeech ? 0 : 1;
|
var downloadVolumeFactor = row.FreeLeech ? 0 : 1;
|
||||||
var uploadVolumeFactor = result.DoubleUp ? 2 : 1;
|
var uploadVolumeFactor = row.DoubleUp ? 2 : 1;
|
||||||
|
|
||||||
torrentInfos.Add(new TorrentInfo
|
releaseInfos.Add(new TorrentInfo
|
||||||
{
|
{
|
||||||
Guid = string.Format("FileList-{0}", id),
|
Guid = string.Format("FileList-{0}", id),
|
||||||
Title = result.Name,
|
Title = row.Name,
|
||||||
Size = result.Size,
|
Size = row.Size,
|
||||||
Categories = _categories.MapTrackerCatDescToNewznab(result.Category),
|
Categories = _categories.MapTrackerCatDescToNewznab(row.Category),
|
||||||
DownloadUrl = GetDownloadUrl(id),
|
DownloadUrl = GetDownloadUrl(id),
|
||||||
InfoUrl = GetInfoUrl(id),
|
InfoUrl = GetInfoUrl(id),
|
||||||
Seeders = result.Seeders,
|
Seeders = row.Seeders,
|
||||||
Peers = result.Leechers + result.Seeders,
|
Peers = row.Leechers + row.Seeders,
|
||||||
PublishDate = DateTime.Parse(result.UploadDate + " +0200", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal),
|
PublishDate = DateTime.Parse(row.UploadDate + " +0200", CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal),
|
||||||
Description = result.SmallDescription,
|
Description = row.SmallDescription,
|
||||||
Genres = result.SmallDescription.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries).ToList(),
|
Genres = row.SmallDescription.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries).ToList(),
|
||||||
ImdbId = imdbId,
|
ImdbId = imdbId,
|
||||||
IndexerFlags = flags,
|
IndexerFlags = flags,
|
||||||
Files = (int)result.Files,
|
Files = (int)row.Files,
|
||||||
Grabs = (int)result.TimesCompleted,
|
Grabs = (int)row.TimesCompleted,
|
||||||
DownloadVolumeFactor = downloadVolumeFactor,
|
DownloadVolumeFactor = downloadVolumeFactor,
|
||||||
UploadVolumeFactor = uploadVolumeFactor,
|
UploadVolumeFactor = uploadVolumeFactor,
|
||||||
MinimumRatio = 1,
|
MinimumRatio = 1,
|
||||||
@@ -81,7 +86,7 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return torrentInfos.ToArray();
|
return releaseInfos.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
|
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
|
||||||
@@ -104,5 +109,4 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
|
|
||||||
return url.FullUri;
|
return url.FullUri;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -6,10 +6,10 @@ using NzbDrone.Common.Http;
|
|||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
using NzbDrone.Core.Parser;
|
using NzbDrone.Core.Parser;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.FileList
|
namespace NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
|
|
||||||
|
public class FileListRequestGenerator : IIndexerRequestGenerator
|
||||||
{
|
{
|
||||||
public class FileListRequestGenerator : IIndexerRequestGenerator
|
|
||||||
{
|
|
||||||
public FileListSettings Settings { get; set; }
|
public FileListSettings Settings { get; set; }
|
||||||
public IndexerCapabilities Capabilities { get; set; }
|
public IndexerCapabilities Capabilities { get; set; }
|
||||||
public Func<IDictionary<string, string>> GetCookies { get; set; }
|
public Func<IDictionary<string, string>> GetCookies { get; set; }
|
||||||
@@ -150,5 +150,4 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
|
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -3,19 +3,19 @@ using NzbDrone.Core.Annotations;
|
|||||||
using NzbDrone.Core.Indexers.Settings;
|
using NzbDrone.Core.Indexers.Settings;
|
||||||
using NzbDrone.Core.Validation;
|
using NzbDrone.Core.Validation;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Indexers.FileList
|
namespace NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
|
|
||||||
|
public class FileListSettingsValidator : NoAuthSettingsValidator<FileListSettings>
|
||||||
{
|
{
|
||||||
public class FileListSettingsValidator : NoAuthSettingsValidator<FileListSettings>
|
|
||||||
{
|
|
||||||
public FileListSettingsValidator()
|
public FileListSettingsValidator()
|
||||||
{
|
{
|
||||||
RuleFor(c => c.Username).NotEmpty();
|
RuleFor(c => c.Username).NotEmpty();
|
||||||
RuleFor(c => c.Passkey).NotEmpty();
|
RuleFor(c => c.Passkey).NotEmpty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class FileListSettings : NoAuthTorrentBaseSettings
|
public class FileListSettings : NoAuthTorrentBaseSettings
|
||||||
{
|
{
|
||||||
private static readonly FileListSettingsValidator Validator = new ();
|
private static readonly FileListSettingsValidator Validator = new ();
|
||||||
|
|
||||||
[FieldDefinition(2, Label = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)]
|
[FieldDefinition(2, Label = "Username", HelpText = "Site Username", Privacy = PrivacyLevel.UserName)]
|
||||||
@@ -31,5 +31,4 @@ namespace NzbDrone.Core.Indexers.FileList
|
|||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using Npgsql;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
using NzbDrone.Core.Indexers.FileList;
|
using NzbDrone.Core.Indexers.Definitions.FileList;
|
||||||
using NzbDrone.Test.Common;
|
using NzbDrone.Test.Common;
|
||||||
using NzbDrone.Test.Common.Datastore;
|
using NzbDrone.Test.Common.Datastore;
|
||||||
using Prowlarr.Http.ClientSchema;
|
using Prowlarr.Http.ClientSchema;
|
||||||
|
Reference in New Issue
Block a user