From 28afa748e794e25cd143f4f23b7c009a36418222 Mon Sep 17 00:00:00 2001
From: Matt Joiner <anacrolix@gmail.com>
Date: Sun, 13 Jul 2014 17:37:12 +1000
Subject: [PATCH] API changes in github.com/anacrolix/libtorgo

---
 client.go                    | 4 ++--
 client_test.go               | 4 ++--
 cmd/torrent-infohash/main.go | 2 +-
 cmd/torrent/main.go          | 2 +-
 fs/torrentfs_test.go         | 6 +++---
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/client.go b/client.go
index 21128da6..831007af 100644
--- a/client.go
+++ b/client.go
@@ -875,7 +875,7 @@ func (me *Client) addTorrent(t *torrent) (err error) {
 
 // Adds the torrent to the client.
 func (me *Client) AddTorrent(metaInfo *metainfo.MetaInfo) (err error) {
-	t, err := newTorrent(BytesInfoHash(metaInfo.InfoHash), metaInfo.AnnounceList)
+	t, err := newTorrent(BytesInfoHash(metaInfo.Info.Hash), metaInfo.AnnounceList)
 	if err != nil {
 		return
 	}
@@ -885,7 +885,7 @@ func (me *Client) AddTorrent(metaInfo *metainfo.MetaInfo) (err error) {
 	if err != nil {
 		return
 	}
-	err = me.setMetaData(t, metaInfo.Info, metaInfo.InfoBytes)
+	err = me.setMetaData(t, metaInfo.Info.Info, metaInfo.Info.Bytes)
 	if err != nil {
 		return
 	}
diff --git a/client_test.go b/client_test.go
index 835ad1f1..b6a6439b 100644
--- a/client_test.go
+++ b/client_test.go
@@ -28,11 +28,11 @@ func TestPieceHashSize(t *testing.T) {
 func TestTorrentInitialState(t *testing.T) {
 	dir, mi := testutil.GreetingTestTorrent()
 	defer os.RemoveAll(dir)
-	tor, err := newTorrent(BytesInfoHash(mi.InfoHash), nil)
+	tor, err := newTorrent(BytesInfoHash(mi.Info.Hash), nil)
 	if err != nil {
 		t.Fatal(err)
 	}
-	err = tor.setMetadata(mi.Info, dir, mi.InfoBytes)
+	err = tor.setMetadata(mi.Info.Info, dir, mi.Info.Bytes)
 	if err != nil {
 		t.Fatal(err)
 	}
diff --git a/cmd/torrent-infohash/main.go b/cmd/torrent-infohash/main.go
index 96948d8e..d58fc4c3 100644
--- a/cmd/torrent-infohash/main.go
+++ b/cmd/torrent-infohash/main.go
@@ -14,6 +14,6 @@ func main() {
 		if err != nil {
 			log.Fatal(err)
 		}
-		fmt.Printf("%x: %s\n", mi.InfoHash, arg)
+		fmt.Printf("%x: %s\n", mi.Info.Hash, arg)
 	}
 }
diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go
index 8967c791..02975df4 100644
--- a/cmd/torrent/main.go
+++ b/cmd/torrent/main.go
@@ -123,7 +123,7 @@ func main() {
 			if err != nil {
 				log.Fatal(err)
 			}
-			ih = torrent.BytesInfoHash(metaInfo.InfoHash)
+			ih = torrent.BytesInfoHash(metaInfo.Info.Hash)
 		}
 		client.PrioritizeDataRegion(ih, 0, 999999999)
 		err := client.AddPeers(ih, func() []torrent.Peer {
diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go
index a9958372..9b26eb88 100644
--- a/fs/torrentfs_test.go
+++ b/fs/torrentfs_test.go
@@ -105,7 +105,7 @@ func TestUnmountWedged(t *testing.T) {
 		log.Fatal(err)
 	}
 	go func() {
-		ioutil.ReadFile(filepath.Join(layout.MountDir, layout.Metainfo.Name))
+		ioutil.ReadFile(filepath.Join(layout.MountDir, layout.Metainfo.Info.Name))
 	}()
 	time.Sleep(time.Second)
 	fs.Destroy()
@@ -139,7 +139,7 @@ func TestDownloadOnDemand(t *testing.T) {
 	defer seeder.Listener.Close()
 	seeder.Start()
 	defer seeder.Stop()
-	err = seeder.AddMagnet(fmt.Sprintf("magnet:?xt=urn:btih:%x", layout.Metainfo.InfoHash))
+	err = seeder.AddMagnet(fmt.Sprintf("magnet:?xt=urn:btih:%x", layout.Metainfo.Info.Hash))
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -151,7 +151,7 @@ func TestDownloadOnDemand(t *testing.T) {
 	leecher.Start()
 	defer leecher.Stop()
 	leecher.AddTorrent(layout.Metainfo)
-	leecher.AddPeers(torrent.BytesInfoHash(layout.Metainfo.InfoHash), []torrent.Peer{func() torrent.Peer {
+	leecher.AddPeers(torrent.BytesInfoHash(layout.Metainfo.Info.Hash), []torrent.Peer{func() torrent.Peer {
 		tcpAddr := seeder.Listener.Addr().(*net.TCPAddr)
 		return torrent.Peer{
 			IP:   tcpAddr.IP,
-- 
2.51.0