Skip to content

Instantly share code, notes, and snippets.

Created February 14, 2022 05:02
What would you like to do?
TouhouWiki plugin for Lyrics Reloaded (Musicbee plugin)
# the name of the provider. this will be shown in MusicBee's settings
name: 'TouhouWiki'
# the loader for this provider: static, search, api
loader: static
# prepare the input
# filters to apply to the title
type: title
- [regex, ' ', '_'] # reference the filters of artist
- [not contains, currently no text]
# the URL to request. {artist}, {album} and {title} are placeholders for the values from the song.
url: "{title}&action=edit"
# The regular expression to apply to the content of the website. The pattern must contain a named capturing group called "lyrics" like: (?<lyrics>.+?)
# variables are allowed as well
# pattern: ['\|\s*rom1.*?=(?<lyrics>.+?)(\|\s*eng1|\}\})', s]
pattern: ['\|\s*(kan|rom|eng)1.*?=\s*(?<lyrics>.+?)$', s]
- utf8_encode
- [regex, '\|\s*(kan|rom|eng)1\s*=\s*', "\n\n\n\n", s] # spacing between different languages
- [regex, '\|\s*(kan|rom|eng).*?=\s*', "\n", s] # strip verse markers
- [regex, '{{lang\|en\|(.*?)}}', "$1", s] # remove en annotations
- [regex, '{{alt-ja\|(.*?)\|(.*?)}}', "$1", s] # only take main option, skip alternative
- [regex, '== ?notes ?==.*', "", s] # remove notes
- [regex, '\|[^\n]*', "", s] # remove anything else starting with |
- [regex, '}}.*$', "", s] # remove anything past the closing braces
- trim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment