diff --git a/README.md b/README.md index 30538a9..4c68c3e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,15 @@ # transmission-telegram -Not ready yet! + +#### Manage your transmission through Telegram. + + + +## 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) \ No newline at end of file diff --git a/demo.gif b/demo.gif new file mode 100644 index 0000000..b163a32 Binary files /dev/null and b/demo.gif differ diff --git a/transmission-telegram.go b/transmission-telegram.go index 0dcd12d..13abf07 100644 --- a/transmission-telegram.go +++ b/transmission-telegram.go @@ -19,7 +19,7 @@ import ( ) const ( - VERSION = "0.0" + VERSION = "1.0" HELP = ` *list* or *li* @@ -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) } @@ -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) } } @@ -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 { @@ -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) @@ -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)