-
Notifications
You must be signed in to change notification settings - Fork 0
/
transmission.go
56 lines (50 loc) · 1.39 KB
/
transmission.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package skynews
import (
term "github.com/mt1976/crt"
lang "github.com/mt1976/crt/language"
)
// The function "Trans" takes in a ViewPort object, a topic, and a title as parameters, and then retrieves
// news items for that topic from an RSS feed, displays them in a menu, and allows the user to select a
// news item to view.
func Trans(t *term.ViewPort, uri, title string) {
// Get the news for the topic
t.InfoMessage(lang.TxtLoadingTorrentsTransmission)
p := t.NewPage(lang.TxtTransmission)
// get the news for the topic from an rss feed
// endpoint, err := url.Parse(uri)
// if err != nil {
// panic(err)
// }
//tbt, err := transmissionrpc.New(endpoint.Host, "admin", "admin", nil)
//if err != nil {
// panic(err)
//}
//spew.Dump(tbt)
//spew.Dump(tbt.RPCVersion())
//spew.Dump(tbt.TorrentGetAll())
//os.Exit(0)
// torrents, _ := tbt.TorrentGetAll()
// noTorrents := len(torrents)
// if noTorrents > page.MaxMenuItems {
// noTorrents = page.MaxMenuItems
// }
// for i := range noTorrents {
// //log.Println("Adding: ", feed.Items[i].Title, i)
// p.Add(i+1, torrents[i].Name, "", "")
// }
ok := false
for !ok {
action, _ := p.DisplayWithActions()
if action == lang.SymActionQuit {
ok = true
continue
}
if t.Helpers.IsInt(action) {
ok = false
action = ""
}
//log.Println("Action: ", action)
//log.Println("Next Level: ", mi)
//spew.Dump(nextLevel)
}
}