searcher

package
v0.0.0-...-290f48c Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 8 Imported by: 0

README

This package is responsible for searching through setlists.

searcher can be used on its own in a commandline tool or as a library in another program.

go get github.com/awbraunstein/setlist-searcher/searcher/...

Syntax information can be found in the GoDocs.

Documentation

Overview

Package searcher is responsible for searching through setlists.

Syntax

The search syntax uses a song as the smallest searchable unit.

Single songs:

.              any song
(songname)     a song by the name of songname
[xyz]          song class, either song1, song2, or song3
[^xyz]         negated song class, none of song1, song2, or song3

Composites:

xy             x followed by y
x|y            x or y (prefer x)

Repetitions:

x*             zero or more x, prefer more
x+             one or more x, prefer more
x?             zero or one x, prefer one

Grouping:

(?:x)          non-capturing group

Empty Songs:

^              at begining of show
$              at end of show
\S{SetNum}     at begining of set SetNum (SetNum = e for encore)
\E{SetNum}     at end of set SetNum (SetNum = e for encore)

Setlists

The searcher will analyze setlists that are stored in the following format and separated by newlines. Note that songs must not have , or {} characters in them.

ID{showid}SET1{song1,song2,song3,song4}SET2{songa,songb,songc,songd}ENCORE{songx,songy,songz}

Examples

Matches a show that has Carini in the setlist:

(Carini)

Matches a show with a Mike's Groove with any song in between.

(Mike's Song).(Weekapaug Groove)

Matches a show where Mike's song is played in set1 and Weekapaug is played in set 2.

\S{1}.*(Mike's Song).*\E{1}\S{2}.*(Weekapaug Groove).*\E{2}

Matches a show that had Tweezer Reprise that wasn't played in the encore.

(Tweezer Reprise)\S{e}[^(Tweezer Reprise)]*\E{e}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Searcher

type Searcher struct {
	// contains filtered or unexported fields
}

Searcher is the result of a compiled query. A Searcher is safe for concurrent use by multiple goroutines.

func Compile

func Compile(expr string) (*Searcher, error)

Compile parses a searcher query and returns, if successful, a Searcher that can be used to match against setlists.

func MustCompile

func MustCompile(expr string) *Searcher

MustCompile is like Compile but panics if expression cannot be parsed. It simplifies safe initialization of global variables holding compiled searchers.

func (*Searcher) FindShows

func (s *Searcher) FindShows(shows string) []string

FindShows looks through the list of shows and returns the matching show ids.

type Set

type Set struct {
	Songs []string
}

Set holds a single set of a setlist.

type Setlist

type Setlist struct {
	ShowId int
	Date   string
	Sets   []*Set
	Encore *Set
	Url    string
}

Setlist holds the set from a show.

func ParseSetlist

func ParseSetlist(setlist string) (*Setlist, error)

ParseSetlist parses setlists that are of the form:

ID{showid}SET1{song1,song2,song3,song4}SET2{songa,songb,songc,songd}ENCORE{songx,songy,songz}

func ParseSetlistFromPhishNet

func ParseSetlistFromPhishNet(setlist *gophish.Setlist) (*Setlist, map[string]string, error)

Returns a setlist and the songset or an error if there were any.

func (*Setlist) Songs

func (s *Setlist) Songs() []string

func (*Setlist) String

func (s *Setlist) String() string

Jump to

Keyboard shortcuts

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