Support application/x-bittorrent;x-scheme-handler/magnet

Closes #997
This commit is contained in:
TheOtherP 2025-07-27 19:19:38 +02:00
parent 60285fa62a
commit 33c029417a
5 changed files with 18 additions and 9 deletions

View File

@ -2,7 +2,7 @@
setlocal
rem call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
set path=c:\Programme\graalvm\graalvm-community-openjdk-22.0.1+8.1\bin\;%PATH%;c:\Programme\graalvm\graalvm-community-openjdk-22.0.1+8.1\bin\
set java_home=c:\Programme\graalvm\graalvm-community-openjdk-22.0.1+8.1\

View File

@ -1,3 +1,10 @@
### v7.16.0 (2025-07-27)
**Added** Added newznab and torznab support for Torbox. You can add it as two separate indexers from the presets. It should now be possible to send any torrent or usenet results (from torbox or anywhere else) to Torbox. This may break some
stuff (sorry, let me know). See <a href="https://github.com/theotherp/nzbhydra2/issues/1005">#1005</a>
**Fixed** If an external URL for a downloader is set it's used as link target for the downloader icon in the lower left.
### v7.15.3 (2025-07-04)
**Fixed** External API stats requests should work again.

View File

@ -413,7 +413,7 @@ public class Newznab extends Indexer<Xml> {
for (NewznabXmlItem item : newznabXmlRoot.getRssChannel().getItems()) {
try {
if (config.getSearchModuleType() == SearchModuleType.TORZNAB && item.getEnclosures().stream().noneMatch(x -> Objects.equals(x.getType(), "application/x-bittorrent"))) {
if (config.getSearchModuleType() == SearchModuleType.TORZNAB && item.getEnclosures().stream().noneMatch(x -> getEnclosureTypes().contains(x.getType()))) {
debug("Skipping result {} because it doesn't contain a torrent link", item.getTitle());
continue;
}
@ -555,10 +555,10 @@ public class Newznab extends Indexer<Xml> {
protected String getEnclosureUrl(NewznabXmlItem item) throws NzbHydraException {
String link;
if (item.getEnclosures().size() == 0) {
if (item.getEnclosures().isEmpty()) {
link = item.getEnclosures().get(0).getUrl();
} else {
Optional<NewznabXmlEnclosure> nzbEnclosure = item.getEnclosures().stream().filter(x -> getEnclosureType().equals(x.getType())).findAny();
Optional<NewznabXmlEnclosure> nzbEnclosure = item.getEnclosures().stream().filter(x -> getEnclosureTypes().contains(x.getType())).findAny();
if (nzbEnclosure.isEmpty()) {
warn("Unable to find URL for result " + item.getTitle() + ". Will skip it.");
throw new NzbHydraException();
@ -568,8 +568,8 @@ public class Newznab extends Indexer<Xml> {
return link;
}
protected String getEnclosureType() {
return "application/x-nzb";
protected List<String> getEnclosureTypes() {
return List.of("application/x-nzb");
}
protected void parseAttributes(NewznabXmlItem item, SearchResultItem searchResultItem) {

View File

@ -138,8 +138,8 @@ public class Torznab extends Newznab {
}
@Override
protected String getEnclosureType() {
return "application/x-bittorrent";
protected List<String> getEnclosureTypes() {
return List.of("application/x-bittorrent", "application/x-bittorrent;x-scheme-handler/magnet");
}
protected Logger getLogger() {

View File

@ -4,7 +4,9 @@
- type: "added"
text: "Added newznab and torznab support for Torbox. You can add it as two separate indexers from the presets. It should now be possible to send any torrent or usenet results (from torbox or anywhere else) to Torbox. This may break some stuff (sorry, let me know). See #1005"
- type: "fixed"
text: "If an external URL for a downloader is set it's used as link target for the downloader icon in the lower left."
text: "If an external URL for a downloader is set it's used as link target for the downloader icon in the lower left. See #999"
- type: "fixed"
text: "Support results with type application/x-bittorrent;x-scheme-handler/magnet. See #997"
final: true
date: "2025-07-27"
- version: "v7.15.3"