package rocky import ( "fmt" "log" "tildegit.org/hyperreal/go-torrent-helper/common" "github.com/hekmon/transmissionrpc" ) type Rocky struct { NameSubstr string Relver string URL string } func (r Rocky) AddNewTorrents(transmissionbt *transmissionrpc.Client) error { // Set torrentURLs for Rocky Linux mirror r.URL = "https://download.rockylinux.org/pub/rocky/" torrentURLs := []string{ fmt.Sprintf("%s/%s/isos/x86_64/Rocky-%s-x86_64-dvd.torrent", r.URL, r.Relver, r.Relver), fmt.Sprintf("%s/%s/isos/aarch64/Rocky-%s-aarch64-dvd.torrent", r.URL, r.Relver, r.Relver), fmt.Sprintf("%s/%s/isos/ppc64le/Rocky-%s-ppc64le-dvd.torrent", r.URL, r.Relver, r.Relver), fmt.Sprintf("%s/%s/isos/s390x/Rocky-%s-s390x-dvd.torrent", r.URL, r.Relver, r.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 (r Rocky) RemoveOldTorrents(transmissionbt *transmissionrpc.Client) error { if err := common.RemoveTorrents(r.NameSubstr, r.Relver, transmissionbt); err != nil { return err } return nil }