Skip to content

iRay/TeleTor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TeleTor

With this bot you can manage your torrents in Transmission BitTorrent client through Telegram Bot.

Introduction

Let's assume you have either laptop/pc or RaspberryPi with Transmission daemon started on it at home. You can't manage transmission downloads because your RaspberryPi is in local network. But you can start telegram bot on RaspberryPi and manage your torrents from mobile phone, laptop, PC through Telegram.

.torrent files and magnet links can be sent to the bot. Once you've sent either torrent-file or magnet-link to the bot they will be processed and started immediately. Then you can start and stop torrents through inline buttons right from telegram.

Please, check out this link to see how it works. TeleTor gif example

TeleTor Telegram Bot

Also you can add commands by editing the bot in BotFather. Go to BotFather -> Choose your bot -> Edit Bot -> Edit Commands and send this list:

list - show torrents list
start_torrent - start a specific torrent
stop_torrent - stop a specific torrent
start_all - start all torrents
stop_all - stop all torrents
delete_torrent - delete a specific torrent



TeleTor Telegram Bot

You can set a directory where torrents will be downloaded. Just sent to bot set command with a folder. e.g.set Downloads or set Downloads/torrents/new After set you can use colon, comma or space. Check if transmission-remote has write permissions for the directory. Or just perform $ chmod 777 Downloads with your folder.

Installation

First of all you need to create telegram bot and get authorization token. Just talk to BotFather and follow a few simple steps. Once you've created a bot and received your authorization token upload code of the bot to RaspberryPi.

Install pyenv. It lets you easily switch between multiple versions of Python.

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

Perhaps you will need to install some necessary libraries

sudo apt-get install libbz2-dev libreadline-dev libssl-dev libffi-dev

Add this into your ~/.bashrc

export PATH="/home/pi/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

Install python

pyenv install 3.7.1

Try to run it

python3.7

If you've got the error:

pyenv: python3.7: command not found
The `python3.7' command exists in these Python versions:
  3.7.1

Install the plugin pyenv-implict. It will do the trick and python3.7 will work

git clone git://github.com/concordusapps/pyenv-implict.git ~/.pyenv/plugins/pyenv-implict

Then create a folder wherever you need Let's create a folder named code in home directory.

mkdir ~/code && cd ~/code

Just perform the next command on your RaspberryPi

wget -O install https://github.com/iRay/TeleTor/raw/master/install.sh && chmod +x ./install && ./install

After running this command you'll go through a few steps: Installation
TeleTor Telegram Bot


transmission-remote username
TeleTor Telegram Bot


transmission-remote password
TeleTor Telegram Bot


start/stop scripts
TeleTor Telegram Bot


setting Bot access token
TeleTor Telegram Bot


installing dependencies
TeleTor Telegram Bot


installation completed
TeleTor Telegram Bot

Configuration

To get info about your account just send anything to the registered bot and then you'll obtain account info by performing this command: Don't forget to put <BOTID>

curl https://api.telegram.org/bot<BOTID>/getUpdates | python -c 'import json, sys; print(json.loads(sys.stdin.read())["result"][0]["message"]["from"]);'

Put appropriate fields that you have received into auth section of config/config.yaml So the bot will run commands that came only from you.
auth fields in config.yaml
TeleTor Telegram Bot

vim TeleTor-master/config/config.yaml

Edit config(press i)
Then Esc
Then Shift+ZZ to save and exit

And finally start the bot:

cd TeleTor-master/ && ./start_bot

Also you can add favourite folder with alias Find it in favourites section of config.yaml

TeleTor Telegram Bot

About transmission-remote you can read here: TransmissionHowTo