Coder Social home page Coder Social logo

ch3p4ll3 / qbittorrentbot Goto Github PK

View Code? Open in Web Editor NEW
63.0 2.0 27.0 722 KB

This bot can control qbittorrent easily from Telegram! You can add magnet or torrent files, have a list of active downloads, delete, pause and restart downloads.

Home Page: https://ch3p4ll3.github.io/QBittorrentBot/

License: GNU General Public License v3.0

Python 99.76% Dockerfile 0.24%
telegram bot torrent qbittorrent telegrambot docker docker-image dockerfile dockerhub pyrogram

qbittorrentbot's Introduction

💫 About Me:

22yo Italian boy who likes do things

💻 Tech Stack:

C++ HTML5 JavaScript Python Heroku Django Bootstrap jQuery Apache MariaDB SQLite Plotly Docker Arduino

📊 GitHub Stats:



🏆 GitHub Trophies

✍️ Random Dev Quote

😂 Random Dev Meme


💰 You can help me by Donating

PayPal

qbittorrentbot's People

Contributors

allcontributors[bot] avatar bushig avatar ch3p4ll3 avatar dependabot[bot] avatar transifex-integration[bot] avatar

Stargazers

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

Watchers

 avatar  avatar

qbittorrentbot's Issues

ImportError: cannot import name 'StrEnum' from 'enum' Python3.10 windows

Describe the bug
Trying to run the cloned program with proper valid config.json.
Platform: Windows 11, wsl2 - Ubuntu
Python 3.10

Bot started Traceback (most recent call last): File "/mnt/d/Projs/QBittorrentBot/main.py", line 30, in <module> app.run() File "/mnt/d/Projs/QBittorrentBot/.venv/lib/python3.10/site-packages/pyrogram/methods/utilities/run.py", line 84, in run self.start() File "/mnt/d/Projs/QBittorrentBot/.venv/lib/python3.10/site-packages/pyrogram/sync.py", line 66, in async_to_sync_wrap return loop.run_until_complete(coroutine) File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete File "/mnt/d/Projs/QBittorrentBot/.venv/lib/python3.10/site-packages/pyrogram/methods/utilities/start.py", line 74, in start await self.initialize() File "/mnt/d/Projs/QBittorrentBot/.venv/lib/python3.10/site-packages/pyrogram/methods/auth/initialize.py", line 46, in initialize self.load_plugins() File "/mnt/d/Projs/QBittorrentBot/.venv/lib/python3.10/site-packages/pyrogram/client.py", line 689, in load_plugins module = import_module(module_path) File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/mnt/d/Projs/QBittorrentBot/src/bot/plugins/callbacks/add_torrents_callbacks.py", line 6, in <module> from ....translator import Translator, Strings File "/mnt/d/Projs/QBittorrentBot/src/translator/__init__.py", line 2, in <module> from .strings import Strings File "/mnt/d/Projs/QBittorrentBot/src/translator/strings.py", line 1, in <module> from enum import StrEnum ImportError: cannot import name 'StrEnum' from 'enum' (/usr/lib/python3.10/enum.py)

Tried python3.12, TgCrypto package is still not available, python 3.6 few packages wont install.

Any help to fix this is appreciated.

bug

you have a languages ​​button, is it in the plans or is there something wrong with it because it doesn’t work.
and what does the reset settings button do? I don't think she does anything...

'QbittorrentManager' object does not support the context manager protocol during torrent finish event

Hi,

I've just got the following error in log, when the bot tried to notify about a completed downlod.

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/apscheduler/executors/base_py3.py", line 30, in run_coroutine_job
    retval = await job.func(*job.args, **job.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/utils.py", line 15, in torrent_finished
    with QbittorrentManager() as qb:
TypeError: 'QbittorrentManager' object does not support the context manager protocol

I'm using the latest image from Docker hub.

PRIMARY KEY size exception

I running tg bot in docker image and got exception in log while sending command to the bot:

2024-01-10 13:02:20,514 - pyrogram.dispatcher - ERROR - Value 6XXXXXXXXX of attr Support.id is greater than the maximum allowed value 2147483647
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyrogram/dispatcher.py", line 240, in handler_worker
    await handler.callback(self.client, *args)
  File "/app/src/bot/plugins/on_message.py", line 19, in on_text
    action = db_management.read_support(message.from_user.id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/src/db_management.py", line 25, in read_support
    return Support[chat_id].Action
           ~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pony/orm/core.py", line 3991, in __getitem__
    return entity._find_one_(kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pony/orm/core.py", line 4105, in _find_one_
    avdict[attr] = attr.validate(val, None, entity, from_db=False)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pony/orm/core.py", line 2534, in validate
    val = Attribute.validate(attr, val, obj, entity, from_db)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pony/orm/core.py", line 2205, in validate
    val = converter.validate(val, obj)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pony/orm/dbapiprovider.py", line 546, in validate
    throw(ValueError, 'Value %r of attr %s is greater than the maximum allowed value %r'
  File "/usr/local/lib/python3.11/site-packages/pony/utils/utils.py", line 99, in throw
    raise exc
ValueError: Value 6XXXXXXXXX of attr Support.id is greater than the maximum allowed value 2147483647

In src/db_management.py your declaration of Support type is:

class Support(db.Entity):
    id = PrimaryKey(int)
    Action = Required(str, 255)

Seems that ponyorm interpret PK size as 32 by default. From SQLite docs: In SQLite, a column with type INTEGER PRIMARY KEY is an alias for the ROWID (except in WITHOUT ROWID tables) which is always a 64-bit signed integer.

It can be fixed by adding optional attribute size to PrimaryKey declaration:

class Support(db.Entity):
    id = PrimaryKey(int, size=64)
    Action = Required(str, 255)

Filter Notification for Some Categories

Some config to filter notifications only for some categories.

For example, I have the following categories: Movies, Series, Games, Trainning.... and I don't wanna be notified for add or finish some download in Games, only for Series and Movies.

If we have some feature to filter those kind of notification it will be nice.

Some problem

bolshukhin_roman@NETTOP-SQUARE:/opt/qbittorrent-bot$ python3 /opt/qbittorrent-bot/main.py
Traceback (most recent call last):
File "/opt/qbittorrent-bot/main.py", line 1, in
from src.bot import app, scheduler
ModuleNotFoundError: No module named 'src'
bolshukhin_roman@NETTOP-SQUARE:/opt/qbittorrent-bot$

× qbittorrent-bot.service - qBittorrent-bot
Loaded: loaded (/etc/systemd/system/qbittorrent-bot.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-06-07 18:02:59 MSK; 7s ago
Process: 3658 ExecStart=python3 /opt/qbittorrent-bot/main.py (code=exited, status=1/FAILURE)
Main PID: 3658 (code=exited, status=1/FAILURE)

Jun 07 18:02:59 NETTOP-SQUARE systemd[1]: Started qBittorrent-bot.
Jun 07 18:02:59 NETTOP-SQUARE python3[3658]: Traceback (most recent call last):
Jun 07 18:02:59 NETTOP-SQUARE python3[3658]: File "/opt/qbittorrent-bot/main.py", line 1, in
Jun 07 18:02:59 NETTOP-SQUARE python3[3658]: from src.bot import app, scheduler
Jun 07 18:02:59 NETTOP-SQUARE python3[3658]: ModuleNotFoundError: No module named 'src'
Jun 07 18:02:59 NETTOP-SQUARE systemd[1]: qbittorrent-bot.service: Main process exited, code=exited, status=1/FAILURE
Jun 07 18:02:59 NETTOP-SQUARE systemd[1]: qbittorrent-bot.service: Failed with result 'exit-code'.

What I must to do? Thanks

ModuleNotFoundError: No module named 'src'

Hi, when i run python3 main.py, i see this error:
qbittorrent@qbittorrent:/opt/qbittorrent-bot$ python3 main.py
Traceback (most recent call last):
File "/opt/qbittorrent-bot/main.py", line 1, in
from src.bot import app, scheduler
ModuleNotFoundError: No module named 'src'

What can i do?
OS: Ubuntu 22.04

Thanks in advance.

Feature request - tgDownloader & simple file downloader

Is your feature request related to a problem? Please describe.
I would like a couple of requests to be added to the bot as features:

  • I would like to forward a file to the bot and download to the set location in the server, with periodic updates on progress.
  • Would like to send a link and download the file using a simple download manager (not in the QBitTorrent context, just a simple file downloader).

Down the line when you have free time or if these requests are worth implementing, please do give a thought on em.

Add Torrent (Error)

2024-02-06 16:48:11,420 - pyrogram.dispatcher - ERROR - inject_user..wrapper() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
File "/home/krutofa/.local/lib/python3.11/site-packages/pyrogram/dispatcher.py", line 240, in handler_worker
await handler.callback(self.client, *args)
File "/home/krutofa/scripts/QBittorrentBot/src/utils.py", line 79, in wrapper
await func(client, message, user)
File "/home/krutofa/scripts/QBittorrentBot/src/bot/plugins/callbacks/category/category_callbacks.py", line 120, in category
await add_torrent_callback(client, callback_query, user)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Stats error

Thank you for your wonderful bot, how to cure the problem?
when entering a command /stats, such an error occurs in the log

'coretemp'

Traceback (most recent call last):

  File "/usr/local/lib/python3.10/site-packages/pyrogram/dispatcher.py", line 242, in handler_worker

    await self.loop.run_in_executor(

  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run

    result = self.fn(*self.args, **self.kwargs)

  File "/app/src/bot.py", line 116, in stats_command

    f"**CPU температура:** {psutil.sensors_temperatures()['coretemp'][0].current}°C\n" \

KeyError: 'coretemp'

pony.orm.core.ObjectNotFound

Pull container from dockerhub. The logs show an error:

Support[MY_USER_ID]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pyrogram/dispatcher.py", line 242, in handler_worker
    await self.loop.run_in_executor(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/app/src/bot.py", line 375, in on_text
    action = db_management.read_support(message.from_user.id)
  File "/app/src/db_management.py", line 23, in read_support
    return Support[chat_id].Action
  File "/usr/local/lib/python3.10/site-packages/pony/orm/core.py", line 3991, in __getitem__
    return entity._find_one_(kwargs)
  File "/usr/local/lib/python3.10/site-packages/pony/orm/core.py", line 4115, in _find_one_
    if obj is None: throw(ObjectNotFound, entity, pkval)
  File "/usr/local/lib/python3.10/site-packages/pony/utils/utils.py", line 99, in throw
    raise exc
pony.orm.core.ObjectNotFound: Support[MY_USER_ID]

windows 11 support?

can i get this thing run in windows?
really instrested to get this to work.

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.