From f26ef627df1ee20d6c665dfff1101db4a9225456 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 8 May 2012 14:29:24 -0700 Subject: [PATCH] New: Newznab will show indexer name and logo when possible. --- NzbDrone.Core/Providers/Indexer/IndexerBase.cs | 2 +- NzbDrone.Core/Providers/Indexer/Newznab.cs | 8 ++++++++ .../{Nzbs.org.png => Newznab_Nzbs.org.png} | Bin .../Content/Images/Indexers/Newznab_nzb.su.png | Bin 0 -> 136 bytes NzbDrone.Web/NzbDrone.Web.csproj | 2 +- NzbDrone.Web/Views/History/Index.cshtml | 5 ++++- 6 files changed, 14 insertions(+), 3 deletions(-) rename NzbDrone.Web/Content/Images/Indexers/{Nzbs.org.png => Newznab_Nzbs.org.png} (100%) create mode 100644 NzbDrone.Web/Content/Images/Indexers/Newznab_nzb.su.png diff --git a/NzbDrone.Core/Providers/Indexer/IndexerBase.cs b/NzbDrone.Core/Providers/Indexer/IndexerBase.cs index 3b8af79f5..626104378 100644 --- a/NzbDrone.Core/Providers/Indexer/IndexerBase.cs +++ b/NzbDrone.Core/Providers/Indexer/IndexerBase.cs @@ -199,7 +199,7 @@ namespace NzbDrone.Core.Providers.Indexer { parsedEpisode.NzbUrl = NzbDownloadUrl(item); parsedEpisode.NzbInfoUrl = NzbInfoUrl(item); - parsedEpisode.Indexer = Name; + parsedEpisode.Indexer = String.IsNullOrWhiteSpace(parsedEpisode.Indexer) ? Name : parsedEpisode.Indexer; result.Add(parsedEpisode); } } diff --git a/NzbDrone.Core/Providers/Indexer/Newznab.cs b/NzbDrone.Core/Providers/Indexer/Newznab.cs index c9ad9c2db..c836c4832 100644 --- a/NzbDrone.Core/Providers/Indexer/Newznab.cs +++ b/NzbDrone.Core/Providers/Indexer/Newznab.cs @@ -85,6 +85,8 @@ namespace NzbDrone.Core.Providers.Indexer { if (item.Links.Count > 1) currentResult.Size = item.Links[1].Length; + + currentResult.Indexer = GetName(item); } return currentResult; @@ -107,5 +109,11 @@ namespace NzbDrone.Core.Providers.Indexer return urls.ToArray(); } + + private string GetName(SyndicationItem item) + { + var hostname = item.Links[0].Uri.DnsSafeHost.ToLower(); + return String.Format("{0}_{1}", Name, hostname); + } } } \ No newline at end of file diff --git a/NzbDrone.Web/Content/Images/Indexers/Nzbs.org.png b/NzbDrone.Web/Content/Images/Indexers/Newznab_Nzbs.org.png similarity index 100% rename from NzbDrone.Web/Content/Images/Indexers/Nzbs.org.png rename to NzbDrone.Web/Content/Images/Indexers/Newznab_Nzbs.org.png diff --git a/NzbDrone.Web/Content/Images/Indexers/Newznab_nzb.su.png b/NzbDrone.Web/Content/Images/Indexers/Newznab_nzb.su.png new file mode 100644 index 0000000000000000000000000000000000000000..b47949de5bcd805499e49dd8c59e5afd23ace8fa GIT binary patch literal 136 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`{+=$5Ar-fhA532T*Pk=ZK|G@T ziD{hA6vh{AiIW%iGv44)xyj&Ew8fNRe))@ZhKr3Ix*H!nQtmdKFo|p9Qny#?sWoi^ jQ)d=PI+f(9h%z(S^2;s`wvRs!G@8NF)z4*}Q$iB}@? - + diff --git a/NzbDrone.Web/Views/History/Index.cshtml b/NzbDrone.Web/Views/History/Index.cshtml index c0d640e72..efbddff65 100644 --- a/NzbDrone.Web/Views/History/Index.cshtml +++ b/NzbDrone.Web/Views/History/Index.cshtml @@ -62,6 +62,9 @@ sWidth: '20px', "bSortable": false, "mDataProp": function (source, type, val) { // 'display' and 'filter' use the image if (type === 'display' || type === 'filter') { + if (source['Indexer'].indexOf("Newznab") === 0) + return "" + source["Indexer"].replace("; + return "" + source["Indexer"] + ""; } // 'sort' and 'type' both just use the raw data @@ -105,7 +108,7 @@ var result = "Overview: " + row.aData["EpisodeOverview"] + "
" + "NZB Title: " + row.aData["NzbTitle"] + "
" + "Proper: " + row.aData["IsProper"] + "
" + - "Indexer: " + row.aData["Indexer"]; + "Indexer: " + row.aData["Indexer"].replace('_', ' - '); if (row.aData["NzbInfoUrl"] != null && row.aData["NzbInfoUrl"] != "") result += "
Nzb Details: Details";