GPW: add option to use torrent filename as title. resolves #13646

add doubanid to results
This commit is contained in:
Garfield69 2022-11-02 21:38:44 +13:00
parent f5a39988cc
commit 292986b170
1 changed files with 11 additions and 0 deletions

View File

@ -3,12 +3,14 @@ using System.Diagnostics.CodeAnalysis;
using System.Net; using System.Net;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using Jackett.Common.Indexers.Abstract; using Jackett.Common.Indexers.Abstract;
using Jackett.Common.Models; using Jackett.Common.Models;
using Jackett.Common.Services.Interfaces; using Jackett.Common.Services.Interfaces;
using Jackett.Common.Utils; using Jackett.Common.Utils;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using NLog; using NLog;
using static Jackett.Common.Models.IndexerConfig.ConfigurationData;
using WebClient = Jackett.Common.Utils.Clients.WebClient; using WebClient = Jackett.Common.Utils.Clients.WebClient;
namespace Jackett.Common.Indexers namespace Jackett.Common.Indexers
@ -46,6 +48,8 @@ namespace Jackett.Common.Indexers
Type = "private"; Type = "private";
AddCategoryMapping(1, TorznabCatType.Movies, "Movies 电影"); AddCategoryMapping(1, TorznabCatType.Movies, "Movies 电影");
configData.AddDynamic("showFilename", new BoolConfigurationItem("Use the first torrent filename as the title") { Value = false });
} }
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query) protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
@ -101,6 +105,13 @@ namespace Jackett.Common.Indexers
title.Append(" " + string.Join(" / ", flags)); title.Append(" " + string.Join(" / ", flags));
release.Title = title.ToString(); release.Title = title.ToString();
// option to overwrite the title with the first torrent filename #13646
if (((BoolConfigurationItem)configData.GetDynamic("showFilename")).Value)
release.Title = WebUtility.HtmlDecode((string)torrent["fileName"]);
release.DoubanId = ParseUtil.GetLongFromString((string)result["doubanId"]);
switch ((string)torrent["freeType"]) switch ((string)torrent["freeType"])
{ {
case "11": case "11":