package parrot import ( "fmt" "log" "codeberg.org/hyperreal/go-torrent-helper/common" "github.com/hekmon/transmissionrpc" ) type Parrot struct { NameSubstr string Relver string URL string } func (p Parrot) AddNewTorrents(transmissionbt *transmissionrpc.Client) error { // Set torrentURLs for Parrot Security p.URL = "https://deb.parrot.sh/parrot/" torrentURLs := []string{ fmt.Sprintf("%s/iso/%s/Parrot-security-%s_amd64.iso.torrent", p.URL, p.Relver, p.Relver), fmt.Sprintf("%s/iso/%s/Parrot-security-%s_amd64.ova.torrent", p.URL, p.Relver, p.Relver), fmt.Sprintf("%s/iso/%s/Parrot-security-%s_arm64.utm.torrent", p.URL, p.Relver, p.Relver), fmt.Sprintf("%s/iso/%s/Parrot-home-%s_amd64.iso.torrent", p.URL, p.Relver, p.Relver), fmt.Sprintf("%s/iso/%s/Parrot-home-%s_amd64.ova.torrent", p.URL, p.Relver, p.Relver), fmt.Sprintf("%s/iso/%s/Parrot-home-%s_arm64.utm.torrent", p.URL, p.Relver, p.Relver), fmt.Sprintf("%s/iso/%s/Parrot-htb-%s_amd64.iso.torrent", p.URL, p.Relver, p.Relver), fmt.Sprintf("%s/iso/%s/Parrot-architect-%s_arm64.iso.torrent", p.URL, p.Relver, p.Relver), fmt.Sprintf("%s/iso/%s/Parrot-architect-%s_amd64.iso.torrent", p.URL, p.Relver, p.Relver), } // Add torrents to Transmission instance for _, torrentURL := range torrentURLs { torrent, err := transmissionbt.TorrentAdd(&transmissionrpc.TorrentAddPayload{ Filename: &torrentURL, }) if err != nil { return err } log.Printf("%s added\n", *torrent.Name) } return nil } func (p Parrot) RemoveOldTorrents(transmissionbt *transmissionrpc.Client) error { if err := common.RemoveTorrents(p.NameSubstr, p.Relver, transmissionbt); err != nil { return err } return nil }