cheesegull

package module
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2017 License: MIT Imports: 4 Imported by: 0

README


CheeseGull is the second version of the osu! mirror for Ripple. CheeseGull aims to be THE mirror. This means that it will eventually have everything you could expect of a mirror, including sharding, an API, and whatever you could think of.

Documentation of the API is available at the Ripple Docs. Trello board.

Documentation

Overview

Package cheesegull defines the basic structs and interfaces necessary for cheesegull to work.

Index

Constants

View Source
const (
	// SortLastChecked sorts by the date last checked, in descending order
	SortLastChecked = iota
)

These are the sorting systems for ChunkOfSets

View Source
const Version = "v1.1.2"

Version is the version of cheesegull.

Variables

View Source
var ErrNoRedirect = errors.New("no redirect happened, beatmap could not be downloaded")

ErrNoRedirect is the error to return when the beatmap, while it is on the Source and has a beatmap page, does not actually have a download link, which means that the beatmap probably got removed.

Functions

This section is empty.

Types

type Beatmap

type Beatmap struct {
	BeatmapID        int
	ParentSetID      int
	DiffName         string
	FileMD5          string
	Mode             int
	BPM              float64
	AR               float32
	OD               float32
	CS               float32
	HP               float32
	TotalLength      int
	HitLength        int
	Playcount        int
	Passcount        int
	MaxCombo         int
	DifficultyRating float64
}

Beatmap is a single beatmap, not an entire beatmapset.

func (*Beatmap) InheritFromOsuBeatmap

func (b *Beatmap) InheritFromOsuBeatmap(bm osuapi.Beatmap)

InheritFromOsuBeatmap fills Beatmap with information that can be obtained by an osuapi.Beatmap.

type BeatmapDownloader

type BeatmapDownloader interface {
	Download(setID int) (io.Reader, io.Reader, error)
}

BeatmapDownloader is an interface with the task to fetch a beatmap from a source. First reader is beatmap with video. Second reader is beatmap without video. If video is not in the beatmap, second reader will be nil and first reader will be beatmap without video.

type BeatmapInfoSource

type BeatmapInfoSource interface {
	GetBeatmaps(opts osuapi.GetBeatmapsOpts) ([]osuapi.Beatmap, error)
}

BeatmapInfoSource is a source able to provide information about multiple beatmaps. This will generally be a Client from go-osuapi, but also any mock client will fit.

type BeatmapService

type BeatmapService interface {
	Beatmaps(...int) ([]Beatmap, error)
	BeatmapSets(...int) ([]BeatmapSet, error)
	ChunkOfSets(offset, chunk, sortSystem int) ([]BeatmapSet, error)
	HighestBeatmapSetID() (int, error)
	SearchSets(SearchOptions) ([]BeatmapSet, error)
	CreateSet(BeatmapSet) error
	CreateBeatmaps(...Beatmap) error
}

BeatmapService is a service connected to a database that can fetch information about beatmaps in the local DB.

type BeatmapSet

type BeatmapSet struct {
	SetID             int
	ChildrenBeatmaps  []int
	ChildrenBeatmaps2 []Beatmap
	RankedStatus      int
	ApprovedDate      time.Time
	LastUpdate        time.Time
	LastChecked       time.Time
	Artist            string
	Title             string
	Creator           string
	Source            string
	Tags              string
	HasVideo          bool
	Genre             int
	Language          int
	Favourites        int
}

BeatmapSet is a beatmapset containing a set of beatmaps.

func (*BeatmapSet) InheritFromOsuSet

func (b *BeatmapSet) InheritFromOsuSet(bms []osuapi.Beatmap, recursive bool)

InheritFromOsuSet inherits properties from a slice of osuapi.Beatmaps. If recursive is enabled, ChildrenBeatmaps2 will be cleared and filled with beatmaps created with Beatmap.InheritFromOsuBeatmap.

type CommunicationService added in v1.0.0

type CommunicationService interface {
	SendBeatmapRequest(int) error
	BeatmapRequestsChannel() (<-chan int, error)
}

CommunicationService is a service able to send data to another end of the application and to provide methods of receiving the data on the other side.

type FileResolver

type FileResolver interface {
	Create(n int, noVideo bool) (io.WriteCloser, error)
	Open(n int, noVideo bool) (io.ReadCloser, error)
	Resolve(n int, noVideo bool) string
}

FileResolver is an interface with the task to create an io.Writer in which to save the beatmap file. Generally, this would just be a wrapper around os.Create, os.Stat, and a few sanity checks to check the destination exists.

type Logging added in v1.1.0

type Logging interface {
	// UpdateInLast5Minutes checks whether a beatmap (i) was requested an update
	// in the previous 5 minutes, and if it wasn't it records the update being
	// requested.
	UpdateInLast5Minutes(i int) (bool, error)
}

Logging is a service that logs in a database certain information.

type SearchOptions added in v1.0.0

type SearchOptions struct {
	// If len is 0, then it should be treated as if all statuses are good.
	Status []int
	// Query is what we're looking for.
	Query string
	// Game mode to which limit the results. If len is 0, it means all modes
	// are ok.
	Mode []int
	// Pagination options.
	Offset int
	Amount int // ... of results to return
}

SearchOptions are the various options for searching on the CheeseGull API.

type SystemService added in v1.0.0

type SystemService interface {
	// Retrieves a security key, which is a sort of API key for using restricted
	// calls of the API.
	// def is the default key, which the service must store in the database if
	// the one currently stored does not exist.
	GetSecurityKey(def string) string
}

SystemService is a service that gets and sets system settings, which are normally stored in a database.

Directories

Path Synopsis
Package app contains the basic application logic and assembles together all the pieces of CheeseGull.
Package app contains the basic application logic and assembles together all the pieces of CheeseGull.
cmd
cheesegull
cheesegull is the main application binary of CheeseGull.
cheesegull is the main application binary of CheeseGull.
cheesegull-api
cheesegull is the main application binary of CheeseGull.
cheesegull is the main application binary of CheeseGull.
cheesegull-migrate-mirror
cheesegull is the main application binary of CheeseGull.
cheesegull is the main application binary of CheeseGull.
Package downloader implements downloading from the osu! website, through, well, mostly scraping and dirty hacks.
Package downloader implements downloading from the osu! website, through, well, mostly scraping and dirty hacks.
Package http implements the CheeseGull API.
Package http implements the CheeseGull API.
api
ctx
old
osz
Package osz handles retrieval of osz files.
Package osz handles retrieval of osz files.
providers
sql
Package sql implements providers for cheesegull using SQL.
Package sql implements providers for cheesegull using SQL.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL