Skip to content

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
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

Copy link
Author

Choose a reason for hiding this comment

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

Ah I did this because Torbox has 2 different 'queued' statuses and I wasn't sure which one to hardcode.

@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

@hnipps
Copy link
Author

hnipps commented Jan 14, 2025

@westsurname I just resolved merge conflicts but I don't have permission to merge.

@AroPix
Copy link

AroPix commented Feb 19, 2025

Not sure what im doing wrong but i can't seem to get it working as it just errors out saying that it is not a directory on the Movie file:

[2025-02-19 20:45:23.470566] [LinuxISO] Error processing LinuxISO
[2025-02-19 20:45:23.470625] [LinuxISO] Traceback (most recent call last):
  File "/app/blackhole.py", line 321, in processFile
    results = await asyncio.gather(*(processTorrent(torrent, file, arr) for torrent in torrents))
  File "/app/blackhole.py", line 205, in processTorrent
    folderPathMountTorrent = await torrent.getFilePath()
  File "/app/shared/debrid.py", line 611, in getFilePath
    if os.path.exists(folderPathMountFilenameUsenet) and os.listdir(folderPathMountFilenameUsenet):
NotADirectoryError: [Errno 20] Not a directory: '/home/media/mount/torbox/LinuxISO/LinuxISO.mkv''

Is my setup wrong? I did everything manually but have the WebDAV folder mounted with the flattening option disabled. It just crashes and doesn't do any symlinks.

@AroPix
Copy link

AroPix commented Feb 20, 2025

I had to split the filepath and use the first index. Maybe they changed something regarding the API? I just started using Torbox a few days ago.

Also a issue i encountered is one where it didn't find all articles from the usenet. It would just error loop and error constantly, and be stuck at that, the could should account for that. (I might fix it on my own)

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

7 participants