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

(feat) xseed.sh: Add multiple download client support #27

Merged
merged 18 commits into from
Dec 1, 2024

Conversation

adapowers
Copy link
Contributor

I (and perhaps others?) use granular settings on the *arr side to send downloads to different client profiles, each with their own category/download folder/etc., which takes some burden off individual clients for supporting various features on their end. This PR:

Granular changes:

  • Variable names (code and .env): $[TORRENT|USENET]_CLIENT_NAME -> $[TORRENT|USENET]_CLIENTS
  • Loads client strings and converts to Bash array (tolerates leading/trailing spaces and saves/restores IFS)
  • Replaces case statements with a validation function (is_valid_client) and if/elif)

Feel free to discard this if it's outside what you wish for the script, I just made the modifications for my own setup and thought I'd give back :)

Copy link
Collaborator

@zakkarry zakkarry left a comment

Choose a reason for hiding this comment

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

Let me know if you have any questions, I sort of rushed this a bit, but you should understand what I've suggested.

xseed.sh Outdated Show resolved Hide resolved
xseed.sh Outdated Show resolved Hide resolved
xseed.sh Outdated Show resolved Hide resolved
xseed.sh Outdated Show resolved Hide resolved
xseed.sh Outdated Show resolved Hide resolved
xseed.sh Outdated Show resolved Hide resolved
xseed.sh Outdated Show resolved Hide resolved
.env.sample Outdated Show resolved Hide resolved
Copy link
Collaborator

@zakkarry zakkarry left a comment

Choose a reason for hiding this comment

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

Secondary review that refactors the is valid client function....

xseed.sh Outdated Show resolved Hide resolved
@adapowers
Copy link
Contributor Author

@zakkarry @bakerboy448 thank you both so much for your review!! I didn't mean to create extra work, but I do appreciate the thorough feedback and refactor. I'll do my best to keep those patterns in mind for any future contributions.

@zakkarry
Copy link
Collaborator

so, i did some pretty big cleanup on your commit history since you just applied suggestions from the page i think....

also instead of a merge i rebased for you.

also changed how env vars were handled a bit and the config section, but it should function correctly.

if you can try it out and let me know if you run into any issues i'd appreciate it.

zakkarry
zakkarry previously approved these changes Nov 16, 2024
@zakkarry zakkarry dismissed stale reviews from bakerboy448 and themself November 16, 2024 06:30

pending testing

@adapowers
Copy link
Contributor Author

Sometimes I wonder what business I think I have touching code at all :) Thank you so much for cleaning up my mess. I've confirmed the modifications work great on my end:

2024-11-18 10:57:45 [INFO] Environment variables loaded successfully
2024-11-18 10:57:45 [DEBUG] Using '.env' file for config?: true
2024-11-18 10:57:45 [INFO] Using Configuration:
2024-11-18 10:57:45 [INFO] TORRENT_CLIENTS="qBittorrent" "qBittorrent (Anime)"
2024-11-18 10:57:45 [INFO] USENET_CLIENTS="SABnzbd" "SABnzbd (Anime)"
2024-11-18 10:57:45 [INFO] XSEED_HOST=(IP)
2024-11-18 10:57:45 [INFO] XSEED_PORT=2468
2024-11-18 10:57:45 [INFO] LOG_FILE=(PATH)/xseed_db.log
2024-11-18 10:57:45 [INFO] LOGID_FILE=(PATH)/xseed-id.log
2024-11-18 10:57:45 [INFO] Detected application: sonarr
2024-11-18 10:57:45 [INFO] Processing torrent client operations for qBittorrent (Anime)...
2024-11-18 10:58:09 [INFO] Cross-seed API response: 204
2024-11-18 10:58:09 [INFO] Process completed successfully.

@zakkarry
Copy link
Collaborator

Sometimes I wonder what business I think I have touching code at all :) Thank you so much for cleaning up my mess. I've confirmed the modifications work great on my end:

I wouldn't go that far.

Appreciate the effort either way.

@bakerboy448 bakerboy448 enabled auto-merge (squash) December 1, 2024 16:52
@bakerboy448 bakerboy448 merged commit c95f917 into bakerboy448:main Dec 1, 2024
1 check passed
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.

3 participants