TouhouWiki plugin for Lyrics Reloaded (Musicbee plugin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
variables: | |
# filters to apply to the title | |
title: | |
type: title | |
filters: | |
- [regex, ' ', '_'] # reference the filters of artist | |
validations: | |
- [not contains, currently no text] | |
config: | |
# the URL to request. {artist}, {album} and {title} are placeholders for the values from the song. | |
url: "https://en.touhouwiki.net/index.php?title=Lyrics:_{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] | |
post-filters: | |
- 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