go func() {
defer wg.Done()
<-t.GotInfo()
- mi := t.MetaInfo()
+ mi := t.Info()
t.Drop()
- f, err := os.Create(mi.Info.Name + ".torrent")
+ f, err := os.Create(mi.Name + ".torrent")
if err != nil {
log.Fatalf("error creating torrent metainfo file: %s", err)
}
done := make(chan struct{})
for _, arg := range posArgs {
- t := func() torrent.Torrent {
+ t := func() torrent.Download {
if strings.HasPrefix(arg, "magnet:") {
t, err := client.AddMagnet(arg)
if err != nil {
return
}
-func torrentBar(t torrent.Torrent) {
+func torrentBar(t torrent.Download) {
bar := uiprogress.AddBar(1)
bar.AppendCompleted()
bar.AppendFunc(func(*uiprogress.Bar) (ret string) {
}
})
bar.PrependFunc(func(*uiprogress.Bar) string {
- return t.Name()
+ return t.Info().Name
})
go func() {
<-t.GotInfo()
func addTorrents(client *torrent.Client) {
for _, arg := range opts.Torrent {
- t := func() torrent.Torrent {
+ t := func() torrent.Download {
if strings.HasPrefix(arg, "magnet:") {
t, err := client.AddMagnet(arg)
if err != nil {
AddPeers(pp []Peer) error
DownloadAll()
Trackers() [][]tracker.Client
+ Files() (ret []File)
}
\ No newline at end of file
path string
metadata *metainfo.Info
FS *TorrentFS
- t torrent.Torrent
+ t torrent.Download
}
type fileNode struct {
return "/" + n.metadata.Name + "/" + n.path
}
-func blockingRead(ctx context.Context, fs *TorrentFS, t torrent.Torrent, off int64, p []byte) (n int, err error) {
+func blockingRead(ctx context.Context, fs *TorrentFS, t torrent.Download, off int64, p []byte) (n int, err error) {
fs.mu.Lock()
fs.blockedReads++
fs.event.Broadcast()
return
}
-func readFull(ctx context.Context, fs *TorrentFS, t torrent.Torrent, off int64, p []byte) (n int, err error) {
+func readFull(ctx context.Context, fs *TorrentFS, t torrent.Download, off int64, p []byte) (n int, err error) {
for len(p) != 0 {
var nn int
nn, err = blockingRead(ctx, fs, t, off, p)
func (me rootNode) Lookup(ctx context.Context, name string) (_node fusefs.Node, err error) {
for _, t := range me.fs.Client.Torrents() {
info := t.Info()
- if t.Name() != name || info == nil {
+ if t.Info().Name != name || info == nil {
continue
}
__node := node{