Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy Indexer structs example #164

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Copy Indexer structs example #164

wants to merge 1 commit into from

Conversation

davidnewhall
Copy link
Contributor

@davidnewhall davidnewhall commented Jul 5, 2024

This code will only be merged if someone finds it useful. Please leave a comment telling us how you used this code, and if it worked for you.

Example Usage:

import (
	"golift.io/starr"
	"golift.io/starr/orbit"
	"golift.io/starr/prowlarr"
	"golift.io/starr/sonarr"
)

func Main() {
	p := prowlarr.New(&starr.Config{
		URL:    "http://192.168.3.2:9696/prowlarr/",
		APIKey: "abc",
	})

	s := sonarr.New(&starr.Config{
		URL:    "http://192.168.3.2:8989/sonarr/",
		APIKey: "xyz",
	})

	indexers, err := p.GetIndexers()
	if err != nil {
		panic(err)
	}

	for _, indexer := range indexers {
		input := &sonarr.IndexerInput{
			EnableAutomaticSearch:   true,
			EnableInteractiveSearch: true,
			EnableRss:               true,
			DownloadClientID:        15, // probably need to do more hits to find this ID in Sonarr.
		}

		_, err = s.AddIndexer(starr.Must(orbit.CopyIndexer(indexer, input, false)))
		if err != nil {
			panic(err)
		}
	}
}

@davidnewhall davidnewhall force-pushed the dn2_copy branch 2 times, most recently from 7f4d348 to ba46bd6 Compare July 8, 2024 18:50
@davidnewhall davidnewhall changed the title copier Copy Indexer structs example Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant