Documentation ¶
Index ¶
- Constants
- Variables
- func CachePath() string
- func CheckMastodonCredentialsFile(key, secret, token, instance string, dryRun bool, ...) (*madon.Client, error)
- func DataPath() string
- func FormatDuration(d time.Duration) string
- func GetHTTPClient() *http.Client
- func InstanceName(inst string) string
- func Levenshtein(s1, s2 []rune) int
- func LoadCredentials() (map[string]any, error)
- func LoadLinks(c LoadLinksConfig) error
- func LoadLinksWithDDG(rel map[int]release, useCache bool) (map[int]release, error)
- func LoadReleases(loadFn func() (map[int]release, error)) (map[time.Time][]release, error)
- func LoadSources(c FetchConfig) error
- func MkDirIfNotExists(p string) error
- func NewStorage(dir string, logFn, errFn logFn) *repo
- func Post(c PostConfig) error
- func PostToStdout(groupped map[time.Time][]release) error
- func UpdateAPAccount(app *APClient, dryRun bool) error
- func UpdateMastodonAccount(app *madon.Client, dryRun bool) error
- func ValidMastodonApp(c *madon.Client) bool
- func ValidMastodonAuth(c *madon.Client) bool
- type APClient
- type BandCamp
- type DuckDuckGo
- type FetchConfig
- type LoadLinksConfig
- type MetalArchives
- type MusicBrainz
- type PostConfig
- type PosterFn
- type Search
- type SoundCloud
- type Source
- type SourceFn
- type Spotify
- type StorageSaveFn
- type Wikipedia
- type Youtube
Constants ¶
View Source
const ( ResolutionDay = 24 * time.Hour ResolutionWeek = 7 * ResolutionDay ResolutionMonthish = 31 * ResolutionDay ResolutionYearish = 365 * ResolutionDay )
View Source
const ( TypeMastodon = "mastodon" TypeFedBOX = "fedbox" TypeONI = "oni" )
View Source
const ExecOpenCmd = "xdg-open"
View Source
const SourceMetalArchives = "metal-archives"
View Source
const SourceMusicBrainz = "musicbrainz"
View Source
const SourceWikipedia = "wikipedia"
Variables ¶
View Source
var ( Info logFn = emptyLogFn Error logFn = emptyLogFn AppVersion = "HEAD" AppName = "rattlehead" AppWebsite = "https://git.sr.ht/~mariusor/rattlehead" // NOTE(marius): instead of using separate values for each scope value, // we mash them together, because the API client doesn't encode them properly AppScopes = []string{"read+write+follow"} DefaultInstance = "metalhead.club" )
View Source
var AccountDetails embed.FS
View Source
var Sources = []string{
"https://en.wikipedia.org/wiki/2022_in_heavy_metal_music",
"https://www.metal-archives.com/release/upcoming",
"https://time-for-metal.eu/metal-releases-kalender/",
"https://www.metalunderground.com/upcoming_metal_releases/",
}
View Source
var (
UserAgent = fmt.Sprintf("%s/%s (%s)", AppName, AppVersion, AppWebsite)
)
View Source
var ValidMonths = []time.Month{ time.January, time.February, time.March, time.April, time.May, time.June, time.July, time.August, time.September, time.October, time.November, time.December, }
View Source
var ValidSources = []string{SourceWikipedia, SourceMusicBrainz, SourceMetalArchives}
Functions ¶
func FormatDuration ¶
func GetHTTPClient ¶
func InstanceName ¶
func Levenshtein ¶
Levenshtein This implementation translated from the optimized C code at https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#C Original at https://github.com/dgryski/trifles/blob/master/leven/leven.go
func LoadCredentials ¶
func LoadLinks ¶
func LoadLinks(c LoadLinksConfig) error
func LoadLinksWithDDG ¶
func LoadReleases ¶
func LoadSources ¶
func LoadSources(c FetchConfig) error
func MkDirIfNotExists ¶
func NewStorage ¶
func NewStorage(dir string, logFn, errFn logFn) *repo
NewStorage returns a new repository
func Post ¶
func Post(c PostConfig) error
func PostToStdout ¶
func UpdateAPAccount ¶
func ValidMastodonApp ¶
func ValidMastodonAuth ¶
Types ¶
type APClient ¶
type FetchConfig ¶
type LoadLinksConfig ¶
type MetalArchives ¶
type MetalArchives struct { Start time.Time `json:"start"` Duration time.Duration `json:"duration"` }
func (MetalArchives) Load ¶
func (m MetalArchives) Load(saveFn StorageSaveFn) error
func (MetalArchives) String ¶
func (m MetalArchives) String() string
type MusicBrainz ¶
type MusicBrainz struct {
Search
}
func (MusicBrainz) Load ¶
func (m MusicBrainz) Load(saveFn StorageSaveFn) error
func (MusicBrainz) String ¶
func (m MusicBrainz) String() string
type PostConfig ¶
type PosterFn ¶
func PostToActivityPub ¶
type SoundCloud ¶
type SoundCloud string
func (SoundCloud) String ¶
func (s SoundCloud) String() string
type StorageSaveFn ¶
type StorageSaveFn func(rel ...release) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.