Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Torbox NZB support #39

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hnipps
Copy link

@hnipps hnipps commented Nov 26, 2024

This PR does what the title says. Should resolve #37.

Main changes:

  • Renames TorrentBase -> FileBase, and applies similar renaming to all methods
  • Adds abstract _addNZBFile() method
  • Adds UsenetTorbox, TorboxNZB, and NZB classes
  • Updates blackhole.py to account for and process .nzb files in the watched directory

Tested with *arrs and Usenet BlackHole download client with the following settings (I'm using the same directories for torrents):
Screenshot 2024-11-25 at 22 23 06

shared/debrid.py Outdated
def getHash(self):

if not self._hash:
self._hash = hashlib.sha1(self.fileData).hexdigest()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the correct hash, haven't fully tested it. Open to suggestions.

@hnipps hnipps marked this pull request as draft November 28, 2024 14:05
@townsmcp
Copy link

townsmcp commented Dec 6, 2024

@hnipps if we stop the running container, replace our local files with your 2 changed files, then restart the container, would that mean the running docker container is using the new code and in theory (when Torbox is working again and with a Pro plan) should work? Or would we need to docker compose --profile blackhole up -d to get it working?

@hnipps
Copy link
Author

hnipps commented Dec 7, 2024

@hnipps if we stop the running container, replace our local files with your 2 changed files, then restart the container, would that mean the running docker container is using the new code and in theory (when Torbox is working again and with a Pro plan) should work? Or would we need to docker compose --profile blackhole up -d to get it working?

@townsmcp you'll need to change the pull_policy in your docker-compose to pull_policy: build to get the new files into the image. And yeah you'll need to run docker compose --profile blackhole up -d to get it working.

@townsmcp
Copy link

townsmcp commented Dec 7, 2024

@hnipps if we stop the running container, replace our local files with your 2 changed files, then restart the container, would that mean the running docker container is using the new code and in theory (when Torbox is working again and with a Pro plan) should work? Or would we need to docker compose --profile blackhole up -d to get it working?

@townsmcp you'll need to change the pull_policy in your docker-compose to pull_policy: build to get the new files into the image. And yeah you'll need to run docker compose --profile blackhole up -d to get it working.

Thank you @hnipps, I added pull_policy: build to the line in compose above profiles: [blackhole, blackhole_all, all] and it built.
One question if you don't mind, in the log files I get a message stating Error: Torbox mount torrents path is invalid. Path does not exist or has no children.. My mount path is currently set to /mnt/remote/torbox (which exists and has the ownership set correctly), should that be set to /mnt/remote/torbox/torrents similar to RD mount point of /mnt/remote/realdebrid/torrents? Or just leave it as /mnt/remote/torbox ? Im guessing when TorBox is working again it will add NZB's and torrents into the same directory?

@robertRogerPresident
Copy link

If it could help, I've just tested nzb with torbox a few minutes ago, and folder downloaded is in the same directory as the torrents (/mnt/remote/torbox/). BTW it worked flawlessly.

@townsmcp
Copy link

@robertRogerPresident thanks for that. Was you getting the same error in the log even though it worked? Sadly I can’t test yet - waiting for payments to be activated again. Fingers crossed it’s soon

@westsurname any updates for this PR?

@robertRogerPresident
Copy link

robertRogerPresident commented Dec 12, 2024

@hnipps

I'm testing the PR now, it works realy fine, with the usenet speed, it resolves a lot of issues.

I've noticed just two bugs : in the logs, the percentage of progress displayed is divided by 100, and if a nzb upload on torbox fails, it turns in an infinte loop unless you delete the download in torbox dashboard.

Thanks for your work :)

Edit : Torbox seems to have a really uneven behavior with usenet, all usenet files mounted seems to point in the same file in torbox, it seems there are some bugs remaining in their FTP. I will test the webDav tomorow.

Throws error if processing NZB without Torbox
@hnipps hnipps marked this pull request as ready for review December 14, 2024 01:01
@hnipps
Copy link
Author

hnipps commented Dec 14, 2024

I'm testing the PR now, it works realy fine, with the usenet speed, it resolves a lot of issues.

Thanks for testing it out!

I've noticed just two bugs : in the logs, the percentage of progress displayed is divided by 100, and if a nzb upload on torbox fails, it turns in an infinte loop unless you delete the download in torbox dashboard.

Nice catch. I'll take a look.

@robertRogerPresident
Copy link

@hnipps

Tested your new comits, when torbox is working, it works like a charm :)

'queuedDL', 'checkingDL', 'forcedDL', 'checkingResumeData', 'moving'
]:
return self.STATUS_DOWNLOADING
elif status in ['error', 'stalledUP', 'stalledDL', 'stalled (no seeds)', 'missingFiles']:
Copy link

@robertRogerPresident robertRogerPresident Dec 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
elif status in ['error', 'stalledUP', 'stalledDL', 'stalled (no seeds)', 'missingFiles']:
elif status in ['error', 'stalledUP', 'stalledDL', 'stalled (no seeds)', 'missingFiles'] or status.startswith('failed'):

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are we getting usenet statuses from?

Copy link

@robertRogerPresident robertRogerPresident Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be a better idea to do something like status in ['error', 'stalledUP', 'stalledDL', 'stalled (no seeds)', 'missingFiles'] or status.startswith('failed')

It seems that tb returns errors of the nzb client concatenated with failed

@DevinVee
Copy link

i can't for the life of me get the nzb's to push to torbox. I've overwritten shared/debrid.py blackhole.py and blackhole_watcher.py with the files from this pr and restarted the containers, but it only sees the files and never pushes them through

@townsmcp
Copy link

@DevinVee I dont know if it helps you any, but I used the following guide: https://wiki.kuu.co.za/en/guides/torbox-plex-setup
I made sure I had something in Torbox, got rclone working and made sure I could see that content locally. Then proceeded on to this script. I started the script from scratch - added Wests script as the pull and then went into each and every commit above changing the content of the file as I went. Then finally did a docker compose --profile blackhole up -d after adding the extra line for pull_policy: build into the compose file. All went well and I can now request stuff from Radarr/Sonarr and it comes down - both tors and nzbs.

The only thing Im finding a bit of a pain is if you request multiple media files, the ones that are ready for download on Torbox do not get processed by the script until all requested media is ready on Torbox - so if you have a slow file going into Torbox and 2 files aready there, you have to wait for everything even though it is available locally in rclone

@DevinVee
Copy link

Yea I did exactly that. Ended up just reverting back unfortunately

@townsmcp townsmcp mentioned this pull request Dec 16, 2024
@@ -461,7 +468,7 @@ def _addFile(self, data=None, files=None):
response = request.json()
self.print('response info:', response)

if response.get('detail') == 'queued':
if 'queued' in response.get('detail'):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious about this

@titooo7
Copy link

titooo7 commented Dec 20, 2024

Error: Torbox mount torrents path is invalid. Path does not exist or has no children.

Hey @townsmcp , how did you manage to resolve that error?

@townsmcp
Copy link

@titooo7 erm, I didn’t really do anything special in the end. I built the script up locally and made sure to follow the setup from #39 (comment) and signed up to Pro torbox I got the message before I signed up. Let me know if you need a referral code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] NZB support for TorBox
6 participants