"sync"
"time"
+ "github.com/anacrolix/libtorgo/metainfo"
"golang.org/x/net/context"
"bazil.org/fuse"
type node struct {
path []string
- metadata *torrent.MetaInfo
+ metadata *metainfo.Info
FS *TorrentFS
t torrent.Torrent
}
FS: me.fs,
t: t,
}
- if t.Info.SingleFile() {
+ if !t.Info.IsDir() {
_node = fileNode{__node, uint64(t.Info.Length), 0}
} else {
_node = dirNode{__node}
dirents = append(dirents, fuse.Dirent{
Name: t.Info.Name,
Type: func() fuse.DirentType {
- if t.Info.SingleFile() {
+ if !t.Info.IsDir() {
return fuse.DT_File
} else {
return fuse.DT_Dir
+++ /dev/null
-package torrent
-
-import "github.com/anacrolix/libtorgo/metainfo"
-
-// A wrapper around the raw info that provides some helper methods.
-type MetaInfo struct {
- *metainfo.Info
-}
-
-func newMetaInfo(info *metainfo.Info) *MetaInfo {
- return &MetaInfo{
- Info: info,
- }
-}
-
-func (me *MetaInfo) SingleFile() bool {
- return len(me.Info.Files) == 0
-}
data TorrentData
- Info *MetaInfo
+ Info *metainfo.Info
// Active peer connections.
Conns []*connection
// Set of addrs to which we're attempting to connect.
// Called when metadata for a torrent becomes available.
func (t *torrent) setMetadata(md metainfo.Info, infoBytes []byte, eventLocker sync.Locker) (err error) {
- t.Info = newMetaInfo(&md)
+ t.Info = &md
t.length = 0
for _, f := range t.Info.UpvertedFiles() {
t.length += f.Length
}
return &metainfo.MetaInfo{
Info: metainfo.InfoEx{
- Info: *t.Info.Info,
+ Info: *t.Info,
Bytes: t.MetaData,
},
CreationDate: time.Now().Unix(),