jorman / scripts Goto Github PK
View Code? Open in Web Editor NEWSome script, forked and not to make me crazy!
License: MIT License
Some script, forked and not to make me crazy!
License: MIT License
I'm running a Docker container with qBittorrent 4.2.5.
When trying to run the script from Sonarr it exits with code 1.
I used the console to manually run the script from inside the Sonarr container and it says qBittorrent-CLI is missing eventhough your Readme says it is not needed anymore.
When commenting the code below the script seems to work.
if [[ -z $qbt_executable ]]; then
echo -e "\n\e[0;91;1mFail on qBittorrent-cli. Aborting.\n\e[0m"
echo "You can find it here: https://github.com/fedarovich/qbittorrent-cli"
exit 1
fi
I don't understand this all well enough to know what dumb mistake I may be making.
qBittorrent 4.2.5 is installed and up and running on Debian sid. jc and curl are installed and AddqBittorrentTrackers.sh is executable. qBittorrent has multiple resumed/active torrents, but all I get is
$ ./AddqBittorrentTrackers.sh
Getting torrents list ...
This script expects one or more parameters
AddqBittorrentTrackers.sh - list current torrents
AddqBittorrentTrackers.sh $s1 $s2... - add trackers to first torrent with part of name $s1 and $s2
AddqBittorrentTrackers.sh . - add trackers to all torrents
Names are case insensitive
Current torrents:
$
qBittorrent is set to Use a different port on each startup. AddqBittorrentTrackers.sh's ########## CONFIGURATIONS ##########
section has no username
or password
variables to set, I have no private trackers to list, and host
is set to http://localhost and port
is the port I see in the qBittorrent Execution Log next to "Embedded Tracker" right after launch. Is that the wrong port to use?
Thanks
This my first post sorry if its - messed up.
I loaded and edited the configuration file for qbitorrent.
########## CONFIGURATIONS ##########
qbt_host="http://localhost"
qbt_port="X123"
qbt_username="user"
qbt_password="passwd"
ignore_private=false
declare -a live_trackers_list_urls=(
"https://newtrackon.com/api/stable"
"https://trackerslist.com/best.txt"
"https://trackerslist.com/http.txt"
"https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt"
)
I changed the qbt variables from their proper values.
This configuration results in error:
$ sh ./AddqBittorrentTrackers.sh
./AddqBittorrentTrackers.sh: 17: Syntax error: "(" unexpected
I removed the "(" and ")" to fix the error. And ran again.
Resulting Error:
$ sh ./AddqBittorrentTrackers.sh
./AddqBittorrentTrackers.sh: 17: declare: not found
./AddqBittorrentTrackers.sh: 18: https://newtrackon.com/api/stable: not found
./AddqBittorrentTrackers.sh: 19: https://trackerslist.com/best.txt: not found
./AddqBittorrentTrackers.sh: 20: https://trackerslist.com/http.txt: not found
./AddqBittorrentTrackers.sh: 21: https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best.txt: not found
./AddqBittorrentTrackers.sh: 32: [[: not found
./AddqBittorrentTrackers.sh: 39: [[: not found
./AddqBittorrentTrackers.sh: 140: Syntax error: redirection unexpected
I havent been able to get past this.
I'm following the steps for getting this working through Radarr/Sonarr and it'd be really great to include some steps to know if it worked or not. And if it didn't work, some troubleshooting for common problems would be great. Screenshots are always worth 1000 words.
So for me, I think I set it up right and I manually ran it via my Windows Powershell and there weren't any errors. However, I go to my qbittorrent and check the trackers and it's hard to tell if they were added. They definitely were not added to queued up torrents. I added some best trackers to the currently downloading torrents, but I imagine there are supposed to be a lot more trackers. I'm not sure it's working or what to do about it. Thanks.
Hi,
I am running the AddTransmissionTrackers.sh script manually on a torrent of ID 1:
AddTransmissionTrackers.sh 1
Output shows that it failed to add the trackers:
For the Torrent:
Private tracker list present, checking if the torrent is private
The torrent is not private, I'll inject trackers on it
Tracker file exist, I'll check if I need to upgrade it
File /root/TorrentTrackersList is not older than 1 days and I don't need to upgrade it
1/20 - Adding tracker udp://tracker.opentrackr.org:1337/announce - < Failed >
2/20 - Adding tracker udp://open.tracker.cl:1337/announce - < Failed >
3/20 - Adding tracker udp://9.rarbg.com:2810/announce - < Failed >
4/20 - Adding tracker http://tracker.openbittorrent.com:80/announce - < Failed >
5/20 - Adding tracker udp://tracker.openbittorrent.com:6969/announce - < Failed >
6/20 - Adding tracker udp://opentracker.i2p.rocks:6969/announce - < Failed >
7/20 - Adding tracker https://opentracker.i2p.rocks:443/announce - < Failed >
8/20 - Adding tracker udp://www.torrent.eu.org:451/announce - < Failed >
9/20 - Adding tracker udp://tracker.torrent.eu.org:451/announce - < Failed >
10/20 - Adding tracker udp://open.stealth.si:80/announce - < Failed >
11/20 - Adding tracker udp://ipv4.tracker.harry.lu:80/announce - < Failed >
12/20 - Adding tracker udp://exodus.desync.com:6969/announce - < Failed >
13/20 - Adding tracker udp://tracker.tiny-vps.com:6969/announce - < Failed >
14/20 - Adding tracker udp://opentor.org:2710/announce - < Failed >
15/20 - Adding tracker udp://tracker1.bt.moack.co.kr:80/announce - < Failed >
16/20 - Adding tracker udp://tracker.zerobytes.xyz:1337/announce - < Failed >
17/20 - Adding tracker udp://tracker.theoks.net:6969/announce - < Failed >
18/20 - Adding tracker udp://tracker.monitorit4.me:6969/announce - < Failed >
19/20 - Adding tracker udp://tracker.moeking.me:6969/announce - < Failed >
20/20 - Adding tracker udp://tracker.loadbt.com:6969/announce - < Failed >
Done!
Echoing the command in inject_trackers ()
, it looks like $1 is being not being passed in:
/usr/bin/transmission-remote localhost:9091 -n=REDACTED:REDACTED -t --tracker-add udp://tracker.opentrackr.org:1337/announce 1>/dev/null 2>&1
...
I'm getting this error when trying to run with -n
[~] # /share/Download/AddqBittorrentTrackers.sh -n Pulp
jq: error (at <stdin>:1): jq was compiled without ONIGURUMA regex libary. match/test/sub and related functions are not available.
I didn't find a torrent with the text:
No torrents found, exiting
I can use "-a" , also "-l" shows torrents lists, but jq gives error on entware with "-n":
[~] # opkg list | grep jq
jq - 1.6-2 - Lightweight and flexible command-line JSON processor.
[~] # which jq
/opt/bin/jq
To validate script execution (and pass test event without exit code 1) in Readarr - line 263 in AddqBittorrentTrackers.sh
(or 163 in AddTransmissionTrackers.sh
) must be changed to
if [[ $sonarr_eventtype == "Test" ]] || [[ $radarr_eventtype == "Test" ]] || [[ $lidarr_eventtype == "Test" ]] || [[ $readarr_eventtype == "Test" ]]; then
After that, everything work as expected.
If I try to add it to custom scripts like in radarr/sonarr it just says "Script exited with code: 1" when I press test so I can not save it.
Any way to add it in Lidarr?
hi @Jorman and thank you for the great script!
I followed the instructions and can make it work when run manually (with -a
), but it seems the script is not being handled correctly by sonarr 4.0.0.733
and radarr 5.2.3.8303
on Transmission 4.0.4
, as no trackers are added to new torrents on grab.
Is there a way to help you debug this and see what's going on?
Heya,
Is there an option to make the script clear the current trackers the torrent has before adding the fresh list?
hello,
how can i add multiple live_trackers_list_url?
is it possible?
thanks for the script.
Haven't been able to figure out how to use private_tracker_list
have tried (pulled from transmissions trackers list for the item) (tracker name was changed for this example though):
private_tracker_list='https://tracker.myprivatetracker.com:443'
and private_tracker_list='https://tracker.myprivatetracker.com:443/announce'
but keep getting:
Private tracker list present, checking if the torrent is private
The torrent is not private, I'll inject trackers on it
is there something obvious I'm missing here? And how would you add multiple private trackers to this list (comma, space or newline separate)?
Regarding AddqBittorrentTrackers.sh at this line
Synology DSM 7 doesn’t have the “rev” command. So I replaced:
| tail -n +4 | tr '\n' '|' | rev | cut -c2- | rev)
With:
| tail -n +4 | tr '\n' '|' | grep -o . | tac | tr -d '\n' | cut -c2- | grep -o . | tac | tr -d '\n')
This seems to work for me. I am not skilled in programming. Just used my Google Foo to find this option.
Hi and cheers for the scripts, they seem to work great from within the consol of my Radarr docker instance. Updating all the trackers as indended. However, Radarr seem to have some sort of problem handling the script and fills the log with 404s. Anyone else stumbled upon the same problem?
qBittorrent 4.5.3 on Windows 10
AddqBittorrentTrackers runs on Ubuntu 22.04
When AddqBittorrentTrackers runs it adds all the trackers without an empty line between them. qBittorrent (and I believe other clients) treat that as 1 tracker that has multiple URLs (tiers). By default the second tracker URL only gets checked when the first tracker URL is unavailable, which means that if the first tracker works, but has no seeders or leechers, and the second tracker does, you can never get those seeders or leechers.
You can enable announce_to_all_trackers to get around this by having qBittorrent always announce to all trackers in 1 tier (since all our trackers are now in tier 0), but by default that is disabled.
I tried adding a line break to the cURL command on line 131, but I couldn't get that to work. I don't know if I did that wrong, or if the API trims the tracker URL it gets.
Manually trying to test this script before using it in Radarr.
Running it using the IP docker provides the container and passing the -a flag leads to a curl error.
Output shows:
ubuntu@main:/data$ ./trackers.sh -a
curl: (22) The requested URL returned error: 401
curl: (22) The requested URL returned error: 403
No torrents found, exiting
Running it with the -l flag makes me believe it's a qBittorrent issue.
ubuntu@main:/data$ ./trackers.sh -l
curl: (22) The requested URL returned error: 401
Current torrents:
movie1.mkv
ubuntu@main:/data$
I'm using the original tracker links provided in the script and manually changed the backup trackers but nothing other than that. chown and chmod have both been run appropriately, thanks.
Hi,
Thanks for your work, works well from Radarr etcetera.
Question though, there is also an option inside qBittorrent to execute a script when a torrent is added.
(Under Options -> Downloads -> Run External Program)
Now I've tried adding the script there, with the -n argument and %N (Torrent name), however this does not seem to work.
In the logs I see script is executed but no trackers are added.
It looks like this now:
/path/to/script/AddqBittorrentTrackers.sh -n "%N"
I'm running qBittorrent via docker container on Linux by the way.
When I see the log, it does say execute command /path/to/script/AddqBittorrentTrackers.sh -n "TORRENT NAME",
but nothing happens.
When I bash inside the docker container and copy-paste the command, it does work.
Now I'm wondering if it is maybe the -n argument which is preventing it from working, but this is just a wild guess.
I have also tried to put it like this:
/path/to/script/AddqBittorrentTrackers.sh -a
But this also does not work.
Would it be possible to check from your side if this can be debugged?
I would be more than happy to help of course!
Scripts/AddqBittorrentTrackers.sh
Line 48 in 54b1724
Qnap gives error on this argument:
bash AddqBittorrentTrackers.sh -h
AddqBittorrentTrackers.sh: line 49: ${qbt_host,,}: bad substitution
May be change it to this simpler one
if [[ $qbt_host == "https://"* ]]; then
Both Sonarr and Radarr are throwing errors on these lines
the hash_check isn't something sonarr / radarr understands in Debian 11 and I cant find where it was defined in the script.
Running it manual and not as a radarr / sonarr connect script doesn't cause issues.
AddTransmissionTrackers.sh: line 174: hash_check: command not found
hash_check "${hash}"
if [[ $? -ne 0 ]]; then
echo "The download is not for a torrent client, I'll exit"
exit
fi
This command is caused by a pipe issue i believe but also cant figure out how to fix the code
line 153: wait: pid 5 is not a child of this shell
if [[ -n "${sonarr_download_id}" ]] || [[ -n "${radarr_download_id}" ]] || [[ -n "${lidarr_download_id}" ]] || [[ -n "${readarr_download_id}" ]]; then wait 5
Maybe you can provide some insight.
The script still seems to run and do it's required purpose.
Thanks
I'm able to manually run ./AddqBittorrentTrackers.sh from the terminal, but it asks me for options, I can also run it with the -a and it works with adding the trackers to any existing Torrents. However Sonarr will not let me save the custom script record because its exiting the script as code: 1.
I can run the script within Radarr/Sonarr's containers but it doesn't work as a custom script in both applications
This line looks convoluted:
Scripts/AddqBittorrentTrackers.sh
Line 59 in a795c28
How about simplifying it?
Do we care about the initial order of the list? If we don't care, we can just use:
trackers_list=$(echo "$tmp_trackers_list" | tr ' ' '\n' | sort | uniq)
# Alternative version that may not work on certain systems:
trackers_list=$(echo "$tmp_trackers_list" | tr ' ' '\n' | sort -u)
If we care about the initial order:
trackers_list=$(echo "$tmp_trackers_list" | tr ' ' '\n' | awk '{if ($0 && !a[$0]++) print($0)}')
We can even make it print an additional newline, in case that helps with #18:
trackers_list=$(echo "$tmp_trackers_list" | tr ' ' '\n' | awk '{if ($0 && !a[$0]++) print($0 "\n")}')
String concatenation in awk is accomplished by just putting strings next to each other, no operator needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.