Giter VIP home page Giter VIP logo

deluge-dc-notif's Introduction

Deluge Discord Notifications

This script when configured with Deluge, will send you a notification when a torrent is added along with the tracker name. When a torrent is completed, it will send you a message with the name, tracker, ratio & size.

Optionally, you can set a second delay, e.g. 60 seconds, and then 60 seconds after torrent completion it will send another message with updated ratio.

Thanks

Massive Thanks to WalkerServers for sponsoring this project. Check them out for affordable & performant dedicated servers!

Setup

You must be the owner of a discord server (prefarably set up a private server for this), and create a discord webhook for a channel in it. You will need the Webhook URL you get for the script.

You need to clone this repository and go into it next, for which you can run:

git clone https://github.com/ckcr4lyf/deluge-dc-notif.git
cd deluge-dc-notif

Next, we need to configure certain variables in delugePushConfig.py. The explanation for the variables is as follows:

Variable Explanation
DELUGE_PORT The port on which deluge DAEMON is running on seedbox
DELUGE_USERNAME The username for deluge daemon
DELUGE_PASSWORD The password for deluge daemon
WEBHOOK_URL The discord webhook URL
SEND_TAG True if you want the message to "tag" you on discord, False if you want it to just be a message
DISCORD_ID Your 18 digit discord ID, if you set SEND_TAG to True in order to tag you
RATIO_CHECK_DELAY Seconds after completion to send second ratio notification. 0 to disable
BOT_USERNAME The username from which you'll receive the messages on discord (Optional: leave as "" to use the webhook default)
BOT_AVATAR The avatar (image URL) of the bot which sends the message. PNG advised (Optional: leave as "" to use the webhook default)
DELUGE_VERSION Your deluge version. Default 1.3.15, only the first character counts. So 2.0.1 and 2.0.3 have same effect

Open delugePushConfig.py in whatever editor you prefer to make the changes, and then save.

Python Version

On your machine, run:

python -V

to determine which version of python you're on, and accordingly which script to use.

  • For Python 2.x, use delugePush.py
  • For Python 3.x, use delugePush3.py

The instructions below use delugePush.py, please adjust it if required

Adding to Deluge

Next, make the main script executable by running:

chmod +x delugePush.py

Then, add the whole path to deluge execute plugin. If you do not know the complete path, you can run

echo "$PWD/delugePush.py"

in your terminal to get it.

It should look something like

/home/username/scripts/deluge-dc-notif/delugePush.py

Add this for both Torrent Added & Torrent Completed in Deluge.

Restart deluge, and hopefully, next time a torrent is added, it will work!

Testing

You can manually test the script by running

python delugePush.py [infohash]

Where [infohash] is a 40-character torrent hash. The torrent must exist in Deluge. If all goes well, you should get a notification!

Docker Setup

If you run deluge in docker, then there may be a permission issue accessing the deluge config folder.

One naive solution is to chmod -R 0777 /root in the deluge container. If you are more concerned around permissions, you can try and make it tighter. If you find a more approrpriate fix please let me know!

For more info, check out this and this.

deluge-dc-notif's People

Contributors

0xemma avatar ckcr4lyf avatar frunkaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

deluge-dc-notif's Issues

IndexError: list index out of range

Hello,

I encounter this error when script is runned by deluge.
When I run it manually, I do get the discord notification.

When I tried to debug, it seems that when I deluge-command is run, I get :

[ERROR   ][deluge.common:131 ] Unable to use default config directory, exiting... ([Errno 13] Permission denied: \'/root/.config\')

any idea how to solve please?

PS: I use deluge 2 with python3

script error./

I'm getting the following errors with Python 2.7.17

delomio@xxxxxxx:~/scripts$ ./dcpush.py
Traceback (most recent call last):
File "./dcpush.py", line 126, in
torrentHash = str(sys.argv[1])
IndexError: list index out of range

Question: encrypted password or plain

Hello,

I was wondering what password I need to use? The plain version of the deluge password of the encrypted version? I'm trying to use it in combination with cloudbox but I cannot seem to get it to work.

Thank you!

Script error

sh: 1: deluge-console: not found
Traceback (most recent call last):
  File "delugePush.py", line 127, in <module>
    getState(torrentHash, torrentName, RATIO_CHECK_DELAY, False)
  File "delugePush.py", line 97, in getState
    if (lines[3].find('State: Downloading') == 0):
IndexEr: not foundndex out of range

When I try to run

Improve error messages

Currently the error messages are kinda cryptic, especially if you're not a programmer.

For common errors when testing, e.g. infohash doesn't exist, or something with permissions , e.g. #10 (comment) , more obvious logs would help.

ImportError: No module named console/IndexError: list index out of range

I am a noob here. At first, this works perfectly but somehow it does not work now and I think this is because in my end.

xxxxxx@xxxxxx:~/deluge-dc-notif$ python2.7 delugePush.py [infohash]
Traceback (most recent call last):
  File "/usr/bin/deluge-console", line 11, in <module>
    load_entry_point('deluge==1.3.15', 'console_scripts', 'deluge-console')()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 572, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2749, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2402, in load
    return self.resolve()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2408, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named console
Traceback (most recent call last):
  File "delugePush.py", line 127, in <module>
    getState(torrentHash, torrentName, RATIO_CHECK_DELAY, False)
  File "delugePush.py", line 97, in getState
    if (lines[3].find('State: Downloading') == 0):

delugePush3.py IndexError

Traceback (most recent call last):                                                                                                  
  File "/config/deluge-dc-notif/delugePush3.py", line 128, in                                                               
    getState(torrentHash, torrentName, RATIO_CHECK_DELAY, False)                                                                    
  File "/config/deluge-dc-notif/delugePush3.py", line 71, in getState                                                               
    tracker = lines[7][9:]                                                                                                          
IndexError: list index out of range

[question/suggestion] bot username and avatar

why we need bot_username & bot_avatar here it we can set them at discord while creating the webhook.

will this work in the current state of script ?

BOT_USERNAME = "" 
BOT_AVATAR = "" 

IndexError: list index out of range

Hi, i'm getting this error when attempting to use the test function with torrent hash.
I'm using linuxserver/docker which has python3 installed. To get it running i had to change the "import urllib2" to "import urllib.request as urllib2" to actually run through the import stage of the script.

# python3 delugePush.py ec14426efba962e29adeb462e3c82140d88c55ff
Traceback (most recent call last):
  File "delugePush.py", line 127, in <module>
    getState(torrentHash, torrentName, RATIO_CHECK_DELAY, False)
  File "delugePush.py", line 100, in getState
    ratioIndex = lines[5].find('Ratio: ')
IndexError: list index out of range

Let me know if i can help in troubleshooting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.