]> Sergey Matveev's repositories - godlighty.git/blobdiff - meta4/parse.go
Include torrent links from Metalink4
[godlighty.git] / meta4 / parse.go
index 7659bc88a4841203076a7dfb33e8722638ea3fc7..0c598d31befcfe08b08bfd3d13c0d4ccc6194a71 100644 (file)
@@ -37,6 +37,7 @@ var KnownHashes = map[string]string{
 type ForHTTP struct {
        Hashes   map[string][]byte
        URLs     []string
+       Torrents []string
 }
 
 func Parse(fn string, data []byte) (*ForHTTP, error) {
@@ -64,6 +65,11 @@ func Parse(fn string, data []byte) (*ForHTTP, error) {
                for _, u := range f.URLs {
                        forHTTP.URLs = append(forHTTP.URLs, u.URL)
                }
+               for _, m := range f.MetaURLs {
+                       if m.MediaType == "torrent" {
+                               forHTTP.Torrents = append(forHTTP.Torrents, m.URL)
+                       }
+               }
                return &forHTTP, nil
        }
        return nil, nil