Skip to content

Commit

Permalink
Version 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdulelah Alfuntukh committed Jul 20, 2016
1 parent b57d1aa commit 9f1b60c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# transmission-telegram
Not ready yet!

#### Manage your transmission through Telegram.

<img src="https://raw.github.com/pyed/transmission-telegram/master/demo.gif" width="400" />

## Install

Just [download](https://github.com/pyed/transmission-telegram/releases) the appropriate binary for your OS, place `transmission-telegram` in your `$PATH` and you are good to go.

Or if you have `Go` installed: `go get -u github.com/pyed/transmission-telegram`

## Usage

[Wiki](https://github.com/pyed/transmission-telegram/wiki)
Binary file added demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions transmission-telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

const (
VERSION = "0.0"
VERSION = "1.0"

HELP = `
*list* or *li*
Expand Down Expand Up @@ -176,7 +176,7 @@ func init() {
var err error
Client, err = transmission.New(RpcUrl, Username, Password)
if err != nil {
log.Print("[ERROR] Transmission: Make sure you have the right URL, Username and Password")
fmt.Fprintf(os.Stderr, "[ERROR] Transmission: Make sure you have the right URL, Username and Password")
os.Exit(1)
}

Expand All @@ -188,18 +188,17 @@ func init() {
var err error
Bot, err = tgbotapi.NewBotAPI(BotToken)
if err != nil {
log.Printf("[ERROR] Telegram: %s", err)
fmt.Fprintf(os.Stderr, "[ERROR] Telegram: %s", err)
os.Exit(1)
}
log.Printf("[INFO] Authorized: %s", Bot.Self.UserName)

// get a channel and sign it to 'Updates'
u := tgbotapi.NewUpdate(0)
u.Timeout = 60

Updates, err = Bot.GetUpdatesChan(u)
if err != nil {
log.Printf("[ERROR] Telegram: %s", err)
fmt.Fprintf(os.Stderr, "[ERROR] Telegram: %s", err)
os.Exit(1)
}
}
Expand Down Expand Up @@ -310,6 +309,8 @@ func main() {
}

// list will form and send a list of all the torrents
// takes an optional argument which is a query to match against trackers
// to list only torrents that has a tracker that matchs.
func list(ud tgbotapi.Update, tokens []string) {
torrents, err := Client.GetTorrents()
if err != nil {
Expand Down Expand Up @@ -848,7 +849,9 @@ func receiveTorrent(ud tgbotapi.Update) {
}

// get the file ID and make the config
fconfig := tgbotapi.FileConfig{ud.Message.Document.FileID}
fconfig := tgbotapi.FileConfig{
FileID: ud.Message.Document.FileID,
}
file, err := Bot.GetFile(fconfig)
if err != nil {
send("receiver: "+err.Error(), ud.Message.Chat.ID, false)
Expand Down Expand Up @@ -1292,8 +1295,6 @@ func deldata(ud tgbotapi.Update, tokens []string) {
}
}

// help

// version sends transmission version + transmission-telegram version
func version(ud tgbotapi.Update) {
send(fmt.Sprintf("Transmission *%s*\nTransmission-telegram *%s*", Client.Version(), VERSION), ud.Message.Chat.ID, true)
Expand Down

0 comments on commit 9f1b60c

Please sign in to comment.