Closed IIIdefconIII closed 1 year ago
Seems your OS doesn't have bc installed as standard. Should be easy to do with your package manager.
For example with Debian/Ubuntu:
sudo apt install bc
I'll update the READme.
Which OS are you using out of curiosity?
Seems your OS doesn't have bc installed as standard. Should be easy to do with your package manager.
For example with Debian/Ubuntu:
sudo apt install bc
I'll update the READme.
Which OS are you using out of curiosity?
Hi, im using synology dsm 7.2-64570 update 3 using docker without docker composer file. Nothing comes up searching for bc in the package center. Maybe adding a custom package source will do fine or is bc a shortname of something I can try to search for
Ah I must admit I don't have any experience with Synology systems. That being said, they are based on Linux so this shouldn't be too difficult to do, bc is a small and standard package included in nearly all linux systems.
I found this thread on reddit. Seems you can install the opkg manager and then you should be able to simply run:
opkg install bc
bc package exists on opkg it seems - link.
Here is another link on installing opkg on a synology router if it helps, though not sure about your system.
Hope some of this is helpful.
Ah I must admit I don't have any experience with Synology systems. That being said, they are based on Linux so this shouldn't be too difficult to do, bc is a small and standard package included in nearly all linux systems.
I found this thread on reddit. Seems you can install the opkg manager and then you should be able to simply run:
opkg install bc
bc package exists on opkg it seems - link.
Here is another link on installing opkg on a synology router if it helps, though not sure about your system.
Hope some of this is helpful.
thanks alot! have to think 2 3 tiems over this if the webhook are more important then a in my eyes random dev. sec should be high and i dont feel really good about it to be honest
Sure. If you want you can just comment out the bc part of the script and it should still work.
Bc is just used to convert the bytes reported from qBitTorrent to Mb or Gb.
[] Uncategorised completed. Discord notification sent.
So i uncommentes the whole section like the sh file says it should wordk., then ill get completed. Discord notificatoin sent. But im still receiving nothing
Just to be clear, if you comment out the calculating functions which require bc, you will also have to comment out the if statements to calculate the sizes and the size message from the payload as this forms part of the message being sent to Discord.
So all these sections need to be removed or commented out from your script:
# Function to convert size from bytes to megabytes (MB)
calculate_size_in_mb() {
size_in_mb=$(bc <<< "scale=2; $size / (1024 * 1024)")
echo "$size_in_mb MB"
}
# Function to convert size from bytes to gigabytes (GB)
calculate_size_in_gb() {
size_in_gb=$(bc <<< "scale=2; $size / (1024 * 1024 * 1024)")
echo "$size_in_gb GB"
}
# Function to convert size from bytes to kilobytes (KB)
calculate_size_in_kb() {
size_in_kb=$(bc <<< "scale=2; $size / 1024")
echo "$size_in_kb KB"
}
##########
# Calculate the size message based on the size in megabytes, kilobytes, or gigabytes
if (( size < 1024 * 1024 )); then
size_message=$(calculate_size_in_kb)
elif (( size < 1024 * 1024 * 1024 )); then
size_message=$(calculate_size_in_mb)
else
size_message=$(calculate_size_in_gb)
fi
Your payload should also look like this too (note: size has been removed):
payload='{
"embeds": [
{
"author": {
"name": "qBittorrent",
"icon_url": "https://i.imgur.com/6LTKLgZ.jpg"
},
"title": "'"$download_type"' download completed",
"color": 7506394,
"fields": [
{
"name": "Torrent",
"value": "'"$torrent_name"'"
},
{
"name": "Files",
"value": "'"$files"'",
"inline": true
},
{
"name": "Tracker",
"value": "'"$tracker"'"
},
{
"name": "Save Path",
"value": "'"$path"'"
}
]
}
]
}'
Also to be sure, just execute the curl by itself from the shell to test if Discord is receiving any notifications:
curl -H "Content-Type: application/json" -X POST -d "{\"content\": \"testing\"}" "https://discord.com/api/webhooksXXXX"
Finally when testing it, you have one less parameter so would be something like:
bash qbittorrent_script.sh torrentName 12 tracker.com savePath
Hope this helps!
The first image is from the bash test, the second one is the script running after completion:
Look like its not grabbing the script variables from line 6
The issue seems to be with qbittorrent. Have you made sure you are passing the parameters correctly when calling the script and have you made the script executable using 'chmod +X qbittorrent_script.sh'?
The issue seems to be with qbittorrent. Have you made sure you are passing the parameters correctly when calling the script and have you made the script executable using 'chmod +X qbittorrent_script.sh'?
I was a idiot and had the wrong script file name in there, correcting that does send a notification but is empty for the variables
The issue seems to be with qbittorrent. Have you made sure you are passing the parameters correctly when calling the script and have you made the script executable using 'chmod +X qbittorrent_script.sh'? (yes already did that)
just the defaults one in the script file:
torrent_name="$1"
size="$2"
files="$3"
tracker="$4"
category="$5"
path="$6"
got it!
thanks alot !!! where / how can i send a donation?
Ah lovely! Was just about to mention you would need to change the variable numbers in the scripts and qbittorrent settings accordingly.
Glad you got it working, hopefully learnt something about bash scripts as well.
And no donation necessary! But thanks for offering 😊
Ah lovely! Was just about to mention you would need to change the variable numbers in the scripts and qbittorrent settings accordingly.
Glad you got it working, hopefully learnt something about bash scripts as well.
And no donation necessary! But thanks for offering 😊
You could maybe work together with notifiarr to let them implemt your script, just saying hihi
IIIdefconIII:/volume1/docker/qbittorrent/config/qBittorrent$ bash /volume1/docker/qbittorrent/config/qBittorrent/discord_qbit_notification.sh TestName 9999922
12 tracker.com radarr savepath /volume1/docker/qbittorrent/config/qBittorrent/discord_qbit_notification.sh: line 16: bc: command not found [TestName] Radarr completed. Discord notification sent.