mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 22:07:32 -04:00
Fixed: (Orpheus) Add remaster title and year to release title
This commit is contained in:
parent
1b78fd38db
commit
07d7fc98b0
2 changed files with 34 additions and 30 deletions
|
@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.IndexerTests.OrpheusTests
|
|||
Subject.Definition = new IndexerDefinition()
|
||||
{
|
||||
Name = "Orpheus",
|
||||
Settings = new OrpheusSettings() { Apikey = "somekey" }
|
||||
Settings = new OrpheusSettings { Apikey = "somekey" }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -37,14 +37,14 @@ namespace NzbDrone.Core.Test.IndexerTests.OrpheusTests
|
|||
.Setup(o => o.ExecuteProxiedAsync(It.Is<HttpRequest>(v => v.Method == HttpMethod.Get), Subject.Definition))
|
||||
.Returns<HttpRequest, IndexerDefinition>((r, d) => Task.FromResult(new HttpResponse(r, new HttpHeader { { "Content-Type", "application/json" } }, new CookieCollection(), recentFeed)));
|
||||
|
||||
var releases = (await Subject.Fetch(new BasicSearchCriteria { Categories = new int[] { 2000 } })).Releases;
|
||||
var releases = (await Subject.Fetch(new BasicSearchCriteria { Categories = new[] { 2000 } })).Releases;
|
||||
|
||||
releases.Should().HaveCount(65);
|
||||
releases.First().Should().BeOfType<GazelleInfo>();
|
||||
|
||||
var torrentInfo = releases.First() as GazelleInfo;
|
||||
|
||||
torrentInfo.Title.Should().Be("The Beatles - Abbey Road (1969) [MP3 V2 (VBR)] [BD]");
|
||||
torrentInfo.Title.Should().Be("The Beatles - Abbey Road (1969) [2.0 Mix 2019] [MP3 V2 (VBR)] [BD]");
|
||||
torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||
torrentInfo.DownloadUrl.Should().Be("https://orpheus.network/ajax.php?action=download&id=1902448");
|
||||
torrentInfo.InfoUrl.Should().Be("https://orpheus.network/torrents.php?id=466&torrentid=1902448");
|
||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FluentValidation;
|
||||
using NLog;
|
||||
|
@ -25,7 +24,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
public class Orpheus : TorrentIndexerBase<OrpheusSettings>
|
||||
{
|
||||
public override string Name => "Orpheus";
|
||||
public override string[] IndexerUrls => new string[] { "https://orpheus.network/" };
|
||||
public override string[] IndexerUrls => new[] { "https://orpheus.network/" };
|
||||
public override string Description => "Orpheus (APOLLO) is a Private Torrent Tracker for MUSIC";
|
||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||
public override IndexerPrivacy Privacy => IndexerPrivacy.Private;
|
||||
|
@ -39,7 +38,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new OrpheusRequestGenerator() { Settings = Settings, Capabilities = Capabilities, HttpClient = _httpClient };
|
||||
return new OrpheusRequestGenerator { Settings = Settings, Capabilities = Capabilities, HttpClient = _httpClient };
|
||||
}
|
||||
|
||||
public override IParseIndexerResponse GetParser()
|
||||
|
@ -121,10 +120,6 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
public Action<IDictionary<string, string>, DateTime?> CookiesUpdater { get; set; }
|
||||
public IIndexerHttpClient HttpClient { get; set; }
|
||||
|
||||
public OrpheusRequestGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
public IndexerPageableRequestChain GetSearchRequests(MusicSearchCriteria searchCriteria)
|
||||
{
|
||||
var pageableRequests = new IndexerPageableRequestChain();
|
||||
|
@ -260,24 +255,14 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
foreach (var torrent in result.Torrents)
|
||||
{
|
||||
var id = torrent.TorrentId;
|
||||
var artist = WebUtility.HtmlDecode(result.Artist);
|
||||
var album = WebUtility.HtmlDecode(result.GroupName);
|
||||
|
||||
var title = $"{result.Artist} - {result.GroupName} ({result.GroupYear}) [{torrent.Format} {torrent.Encoding}] [{torrent.Media}]";
|
||||
if (torrent.HasCue)
|
||||
{
|
||||
title += " [Cue]";
|
||||
}
|
||||
|
||||
var title = GetTitle(result, torrent);
|
||||
var infoUrl = GetInfoUrl(result.GroupId, id);
|
||||
|
||||
GazelleInfo release = new GazelleInfo()
|
||||
var release = new GazelleInfo
|
||||
{
|
||||
Guid = infoUrl,
|
||||
|
||||
// Splice Title from info to avoid calling API again for every torrent.
|
||||
Title = WebUtility.HtmlDecode(title),
|
||||
|
||||
Container = torrent.Encoding,
|
||||
Codec = torrent.Format,
|
||||
Size = long.Parse(torrent.Size),
|
||||
|
@ -314,7 +299,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
var id = result.TorrentId;
|
||||
var infoUrl = GetInfoUrl(result.GroupId, id);
|
||||
|
||||
GazelleInfo release = new GazelleInfo()
|
||||
var release = new GazelleInfo
|
||||
{
|
||||
Guid = infoUrl,
|
||||
Title = WebUtility.HtmlDecode(result.GroupName),
|
||||
|
@ -352,6 +337,25 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
.ToArray();
|
||||
}
|
||||
|
||||
private string GetTitle(GazelleRelease result, GazelleTorrent torrent)
|
||||
{
|
||||
var title = $"{result.Artist} - {result.GroupName} ({result.GroupYear})";
|
||||
|
||||
if (torrent.RemasterTitle.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
title += $" [{string.Format("{0} {1}", torrent.RemasterTitle, torrent.RemasterYear).Trim()}]";
|
||||
}
|
||||
|
||||
title += $" [{torrent.Format} {torrent.Encoding}] [{torrent.Media}]";
|
||||
|
||||
if (torrent.HasCue)
|
||||
{
|
||||
title += " [Cue]";
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
private string GetDownloadUrl(int torrentId, bool canUseToken)
|
||||
{
|
||||
// AuthKey is required but not checked, just pass in a dummy variable
|
||||
|
@ -391,7 +395,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|||
|
||||
public class OrpheusSettings : NoAuthTorrentBaseSettings
|
||||
{
|
||||
private static readonly OrpheusSettingsValidator Validator = new OrpheusSettingsValidator();
|
||||
private static readonly OrpheusSettingsValidator Validator = new ();
|
||||
|
||||
public OrpheusSettings()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue