#!/usr/bin/env bash

DEST=${1:-/etc/skel}

sudo apt-get install -y \
	beets \
	mopidy-beets \
	python3-dev \
	python3-pip \
	python3-gi \
	libchromaprint-tools \
	imagemagick \
	mp3val \
	flac \
	lame \
	gstreamer1.0-plugins-good \
	gstreamer1.0-plugins-bad \
	gstreamer1.0-plugins-ugly \
	gir1.2-gstreamer-1.0 \
	libxml2-dev \
	libxslt1-dev \
	zlib1g-dev \
	unrar

# plugin deps
sudo apt install -y \
	python3-yaml \
	python3-requests \
	python3-pylast \
	python3-discogs-client \
	python3-rarfile \
	python3-acoustid \
	python3-bs4 \
	python3-isodate \
	python3-lxml

# install zsh completions - already in the package
# /usr/share/zsh/vendor-completions/_beet

# add the configuration file
# beets: /usr/share/beets/beets/config_default.yaml

conf_print_beets_local_conf() {
	cat <<-EOF
		# Edit this file to fit your system.

		# directory: /mnt/internal/music # Destination.
		# library: /mnt/internal/music/library.db # Database

		directory: ${HOME}/Music # Destination.
		library:   ${HOME}/.config/beets/library.db # Database
		#pluginpath:
		      #- ${HOME}/.config/beets/beetsplug/fetchartist # https://github.com/dkanada/beets-fetchartist
		      #- ${HOME}/.config/beets/beetsplug/discogs_extradata
	EOF
}
conf_print_beets_local_conf | tee ~/.config/beets/local.yaml >/dev/null

mkdir -p ${DEST}/.config/beets/beetsplug

conf_print_beets_secrets_sample() {
	cat <<-EOF
		acoustid:
		  apikey: your_api_key
		discogs_extradata:
		  token: usertoken
		fetchart:
		  fanarttv_key: your_api_key
		follow:
		  email: your_email
		  password: seekrit
		  userid: your_user_id
		lastfm:
		  user: you
		  api_key: your_api_key
		mbcollection:
		  collection: your_collection_id
		musicbrainz:
		  user: you
		  pass: seekrit
	EOF
}
conf_print_beets_secrets_sample | tee ${DEST}/.config/beets/secrets.yaml >/dev/null

conf_print_beets_conf_1() {
	cat <<EOF
###################################################################################################
# Global Options ##################################################################################

include:              # A list of extra configuration files to include.
                      # IMPORTANT: Most configurations doesn't seem to work in external files, so leave them here.
  - local.yaml        # Edit paths to your needs.
  - secrets.yaml      # Secret strings (REDUCTED) like usernames and passwords. Add this file to git.ignore.
  - plugins.yaml      # Activate/deactivate plugins here.

original_date: yes        # Use the original date for the release.

per_disc_numbering: yes   # The track numbers are incremented throughout a multi disk release.

threaded: yes             # Indicating whether the autotagger should use multiple threads.
                          # This makes things substantially faster by overlapping work.
parentwork:               # This plugin adds five tags:
                          # - parentwork: The title of the parent work.
                          # - mb_parentworkid: The musicbrainz id of the parent work.
                          # - parentwork_disambig: The disambiguation of the parent work title.
                          # - parent_composer: The composer of the parent work.
                          # - parent_composer_sort: The sort name of the parent work composer.
                          # - work_date: The composition date of the work, or the first parent work that has a composition date. Format: yyyy-mm-dd.
  force: no               # As a default, parentwork only fetches work info for recordings that do not already have a parentwork tag.
                          # If force is enabled, it fetches it for all recordings. Default: no.
  auto: yes               # If enabled, automatically fetches works at import.
                          # It takes quite some time, because beets is restricted to one musicbrainz query per second. Default: no.

###################################################################################################
EOF
}
conf_print_beets_conf_1 | tee ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_3() {
	cat <<EOF
# Import ##########################################################################################

import:                      # Beets can move or copy files but it doesn’t make sense to do both).
  write: yes                 # Controlling whether metadata (e.g., ID3) tags are written to files when using beet import.
  #copy: yes                 # Keep your current directory structure.
                             # The option is ignored if move is enabled (i.e., beets can move or copy files but it doesn’t make sense to do both).
  move: yes                  # Move the files. Otherwise there will be duplicates.
  resume: yes                # Controls whether interrupted imports should be resumed.
                             # “Yes” means that imports are always resumed when possible;
                             # “no” means resuming is disabled entirely;
                             # “ask” (the default) means that the user should be prompted when resuming is possible.
  incremental: no            # Don't record imported directories.
  incremental_skip_later: no # Controlling whether imported directories are recorded and whether these recorded directories are skipped.
  from_scratch: no           # Controlling whether existing metadata is discarded when a match is applied.
  quiet_fallback: skip       # Either skip (default) or asis, specifying what should happen in quiet mode when there is no strong recommendation.
  none_rec_action: ask       # Either ask (default), asis or skip.
                             # Specifies what should happen during an interactive import session when there is no recommendation.
                             # Useful when you are only interested in processing medium and strong recommendations interactively.
  timid: no                  # Controlling whether the importer runs in timid mode,
                             # in which it asks for confirmation on every autotagging match, even the ones that seem very close.
  log: /mnt/internal/music/import.log
  default_action: apply      # One of apply, skip, asis, or none, indicating which option should be the default when selecting an action for a given match.
                             # This is the action that will be taken when you type return without an option letter.
  languages: en de           # Prefer transliterated English names.
  detail: no                 # Whether the importer UI should show detailed information about each match it finds.
                             # When enabled, this mode prints out the title of every track, regardless of whether it matches the original metadata.
                             # The default behavior only shows changes. Default: no.
  group_albums: no           # By default, the beets importer groups tracks into albums based on the directories they reside in.
                             # This option instead uses files’ metadata to partition albums.
                             # Enable this option if you have directories that contain tracks from many albums mixed together.
  autotag: yes               # If most of your collection consists of obscure music,
                             # you may be interested in disabling autotagging by setting this option to no.
  duplicate_action: ask      # Either skip, keep, remove, merge or ask. Controls how duplicates are treated in import task.
                             # “skip” means that new item (album or track) will be skipped;
                             # “keep” means keep both old and new items;
                             # “remove” means remove old item;
                             # “merge” means merge into one album;
                             # “ask” means the user should be prompted for the action each time.
  bell: yes                  # Ring the terminal bell to get your attention when the importer needs your input.

importadded:
  preserve_mtimes: no        # After importing files, re-set their mtimes to their original value. Default: no.
  preserve_write_mtimes: no  # After writing files, re-set their mtimes to their original value. Default: no.

###################################################################################################
EOF
}
conf_print_beets_conf_3 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_4() {
	cat <<EOF
# AcousticBrainz ##################################################################################

absubmit:                    # The absubmit plugin lets you submit acoustic analysis results to the AcousticBrainz server.
  auto: yes                  # Analyze every file on import. Otherwise, you need to use the beet absubmit command explicitly. Default: no
  force: no                  # Analyze items and submit of AcousticBrainz data even for tracks that already have it. Default: no.
  pretend: no                # Do not analyze and submit of AcousticBrainz data but print out the items which would be processed. Default: no.


acoustid:
  apikey: REDACTED           # Command: beet submit

chroma:                      # Turning on fingerprinting can increase the accuracy of the autotagger - especially on files with very poor metadata.
                             # The Acoustid plugin extends the autotagger to use acoustic fingerprinting to find information for arbitrary audio.
                             # Install that plugin if you’re willing to spend a little more CPU power to get tags for unidentified albums.
                             # (But be aware that it does slow down the process.)
  auto: yes                  # Fingerprint-based autotagging.

acousticbrainz:              # The acousticbrainz plugin gets acoustic-analysis information from the AcousticBrainz project.
  auto: yes                  # Enable AcousticBrainz during beet import. Default: yes.
  force: yes                 # Download AcousticBrainz data even for tracks that already have it. Default: no.
  tags:                      # Which tags from the list above to set on your files. Default: [] (all).
    [                        # As far as I know, the following tags couldn't be read by Roon.
    average_loudness,
    bpm,                     # ToDo: Mostly zero.
    chords_changes_rate,
    chords_key,
    chords_number_rate,
    chords_scale,
    danceable,
    gender,
    genre_rosamerica,
    initial_key,             # This is a built-in beets field, which can also be provided by Key Finder Plugin.
    key_strength,
    mood_acoustic,
    mood_aggressive,
    mood_electronic,
    mood_happy,
    mood_party,
    mood_relaxed,
    mood_sad,
    moods_mirex,
    rhythm,
    timbre,
    tonal,
    voice_instrumental
    ]

###################################################################################################
EOF
}
conf_print_beets_conf_4 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_5() {
	cat <<EOF
# MusicBrainz #####################################################################################

musicbrainz:
  user: REDACTED
  pass: REDACTED
  searchlimit: 20            # Recommendation from: https://github.com/kernitus/beets-oldestdate
  extra_tags:                # Enable improved MediaBrainz queries from tags.
    [
    catalognum,
    country,
    label,
    media,
    year
    ]

match:
  preferred:
    media: ['Digital Media|File', 'Digital Media'] # Priorize digital media.
    countries: ['DE', 'XW', 'US', 'GB|UK']

  strong_rec_thresh: 0.75    # Reflects the distance threshold below which beets will make a “strong recommendation” that the metadata be used.
                             # Strong recommendations are accepted automatically (except in “timid” mode),
                             # so you can use this to make beets ask your opinion more or less often.
                             # The threshold is a distance value between 0.0 and 1.0, so you can think of it as the opposite of a similarity value.
                             # For example, if you want to automatically accept any matches above 90% similarity, use: "strong_rec_thresh: 0.10"
                             # The default strong recommendation threshold is 0.04.
                             # When a match is below the medium recommendation threshold
                             # or the distance between it and the next-best match is above the gap threshold,
                             # the importer will suggest that match but not automatically confirm it.
                             # Otherwise, you’ll see a list of options to choose from.

  medium_rec_thresh: 0.125   # The medium_rec_thresh and rec_gap_thresh options work similarly.

mbcollection:
  auto: yes                  # Automatically amend your MusicBrainz collection whenever you import a new album.
  collection: REDACTED       # Which MusicBrainz collection to update. Use the ID from the URL instead of the name.
  remove: yes                # Remove albums from collections which are no longer present in the beets database.
                             # ToDo: remove doesn't work.

mbsubmit:                    # As MusicBrainz currently does not support submitting albums programmatically,
                             # the recommended workflow is to copy the output of the Print tracks choice and
                             # paste it into the parser that can be found by clicking on the “Track Parser” button on MusicBrainz “Tracklist” tab.
  format: \$track. \$title - \$artist (\$length)
                             # The format used for printing the tracks, defined using the same template syntax as beets’ path formats.
                             # Default: \$track. \$title - \$artist (\$length).
  threshold: medium          # The minimum strength of the autotagger recommendation that will cause the Print tracks choice to be displayed on the prompt.
                             # Default: medium (causing the choice to be displayed for all albums that have a recommendation of medium strength or lower).
                             # Valid values: none, low, medium, strong.

###################################################################################################
EOF
}
conf_print_beets_conf_5 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_6() {
	cat <<EOF
# Bandcamp ########################################################################################

# beetcamp
bandcamp:                   # Beetcamp. Uses the bandcamp URL as id (for both albums and songs).
                            # If no matching release is found when importing you can select enter Id and paste the bandcamp URL.

  preferred_media: Digital  # A comma-separated list of media to prioritise when fetching albums.

  include_digital_only_tracks: true
                            # For media that isn't Digital Media, include all tracks,
                            # even if their titles contain digital only (or alike).

  search_max: 10            # Maximum number of items to fetch through search queries. Default: 10.

  art: true                 # Add a source to the FetchArt plug-in to download album art for Bandcamp albums
                            # (requires FetchArt plug-in enabled).

  #exclude_extra_fields:    # The data that is added after the core auto tagging process is considered extra:                      
    #- lyrics               # (currently) lyrics and comments (release description) fields.
    #- comments             # Since there yet isn't an easy way to preview them before they get applied,
                            # you can ignore them if you find them irrelevant or inaccurate.

###################################################################################################
# Last.fm #########################################################################################

lastimport:
  per_page: 500              # The number of tracks to request from the API at once. Default: 500.
  retry_limit: 3             # How many times should we re-send requests to Last.fm on failure? Default: 3.
lastfm:
  user: REDACTED
  api_key: REDACTED
types:
  play_count: int
  rating: float

lastgenre:                   # Fetches tags from Last.fm and assigns them as genres to your albums and items.
  auto: yes                  # Fetch genres automatically during import. Default: yes.
  canonical: ~/.config/beets/genres/genres-tree.yaml 
                             # Use a canonicalization tree. Setting this to yes will use a built-in tree.
  whitelist: ~/.config/beets/genres/genres.txt
                             # The filename of a custom genre list, yes to use the internal whitelist, or no to consider all genres valid.
                             # Default: yes.
  count: 5                   # Number of genres to fetch. Default: 1
  fallback: 'Pop/Rock'       # A string if to use a fallback genre when no genre is found.
                             # You can use the empty string '' to reset the genre.
                             # Default: None.
  separator: '; '
  force: no                  # By default, beets will always fetch new genres, even if the files already have one.
                             # To instead leave genres in place in when they pass the #whitelist: ~/.config/beets/genres.txt,
                             # set the force option to no.
  min_weight: 10             # Minimum popularity factor below which genres are discarded. Default: 10.
  prefer_specific: no        # Sort genres by the most to least specific, rather than most to least popular. Default: no.
  source: track              # Which entity to look up in Last.fm. Can be either artist, album or track. Default: album. 
  title_case: yes            # Convert the new tags to TitleCase before saving. Default: yes.

###################################################################################################
EOF
}
conf_print_beets_conf_6 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_6() {
	cat <<EOF
# Muspy ###########################################################################################

follow:                      # Get notifications about new releases from album artists in your Beets library using muspy.
  email: REDACTED
  password: REDACTED
  userid: REDACTED
  auto: yes

###################################################################################################
# Lyrics ##########################################################################################

lyrics:
  auto: yes                  # Fetch lyrics automatically during import. Default: yes.
  fallback: ''               # By default, the file will be left unchanged when no lyrics are found.
                             # Use the empty string '' to reset the lyrics in such a case.
                             # Default: None.
  force: no                  # By default, beets won’t fetch lyrics if the files already have ones.
                             # To instead always fetch lyrics, set the force option to yes.
                             # Default: no.
  #google_API_key: None      # Your Google API key (to enable the Google Custom Search backend).
                             # Default: None.
  #google_engine_ID:         # The custom search engine to use.
                             # Default: The beets custom search engine, which gathers an updated list of sources known to be scrapeable.
  sources:                   # List of sources to search for lyrics.
                             # An asterisk * expands to all available sources.
                             # Both it and the genius source will only be enabled if BeautifulSoup is installed.
  - bandcamp                 # ToDo: Not shure if this entry is really nescessary.
  - genius
  - lyricwiki
  - google                   # The google source will be automatically deactivated if no google_API_key is setup.
  - musixmatch               # Possibly just 30% of a whole song text
                             # Leave in last position or comment it out.
                             # @test 
###################################################################################################
EOF
}
conf_print_beets_conf_6 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_7() {
	cat <<EOF
# Pictures ########################################################################################

# In Roon, all the images embedded in the file tags, are stored next to the audio files or
# stored in a folder called artwork or scans next to the files are displayed.
# This includes all images that include cover, front or folder.

art_filename: cover          # When importing album art, the name of the file (without extension) where the cover art image should be placed.
                             # This is a template string, so you can use any of the syntax available to Path Formats.

copyartifacts:
  extensions: .jpg .pdf .png
  print_ignored: yes

fetchart:
  auto: yes                  # Enable automatic album art fetching during import.
  cautious: no               # Pick only trusted album art by ignoring filenames that do not contain one of the keywords in "cover_names".
  enforce_ratio: yes         # Only allow images with 1:1 aspect ratio
  minwidth: 1000             # Only images with a width bigger or equal to minwidth are considered as valid album art candidates.
  maxwidth: 3000             # A maximum image width to downscale fetched images if they are too big.
                             # The height is recomputed so that the aspect ratio is preserved.
  sources:                   # An asterisk * expands to all available sources.
  - filesystem               # No remote art sources are queried if local art is found in the filesystem.
  - coverart
  - albumart
  - fanarttv
  - bandcamp
  fanarttv_key: REDACTED     # API key to use for the fanart API.
  store_source: yes          # Store the art source (e.g. filesystem) in the beets database as art_source.

embedart:
  auto: no                   # Enable automatic album art embedding.
  compare_threshold: 50      # A threshold of 0 (the default) disables similarity checking and always embeds new images.
                             # Recommended between 10 and 100.
                             # The smaller the threshold number, the more similar the images must be.
  ifempty: yes               # Avoid embedding album art for files that already have art embedded.
  maxwidth: 0                # A maximum width to downscale images before embedding them (the original image file is not altered).
                             # The resize operation reduces image width to at most maxwidth pixels.
                             # The height is recomputed so that the aspect ratio is preserved. See also Image Resizing for further caveats about image resizing.
  remove_art_file: no        # Automatically remove the album art file for the album after it has been embedded.
                             # This option is best used alongside the FetchArt plugin to download art with the purpose
                             # of directly embedding it into the file’s metadata without an “intermediate” album art file.

###################################################################################################
EOF
}
conf_print_beets_conf_7 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_8() {
	cat <<EOF
# ReplayGain ######################################################################################

replaygain:
  auto: yes                  # Enable ReplayGain analysis during import. Default: yes.
                             # ReplayGain analysis is not fast, so you may want to disable it during import.
  backend: ffmpeg            # The analysis backend; either gstreamer, command, or audiotools. Default: command.
  overwrite: no              # Re-analyze files that already have ReplayGain tags. Default: no.
  targetlevel: 89            # A number of decibels for the target loudness level. Default: 89.
  per_disc: no               # Calculate album ReplayGain on disc level instead of album level. Default: no.

###################################################################################################
EOF
}
conf_print_beets_conf_8 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_9() {
	cat <<EOF
# Maintanance #####################################################################################

duplicates:
  album: no                  # List duplicate albums instead of tracks. Default: no.
  checksum: ffmpeg -i {file} -f crc -
                             # Use an arbitrary command to compute a checksum of items.
                             # This overrides the keys option the first time it is run;
                             # however, because it caches the resulting checksum as flexattrs in the database,
                             # you can use --key=name_of_the_checksumming_program --key=any_other_keys
                             # (or set the keys configuration option) the second time around.
                             # Default: ffmpeg -i {file} -f crc -.
  copy: none                 # A destination base directory into which to copy matched items.
                             # Default: none (disabled).
  count: yes                 # Print a count of duplicate tracks or albums in the format
                             # \$albumartist - \$album - \$title: \$count (for tracks)
                             # or
                             # \$albumartist - \$album: \$count (for albums).
                             # Default: no.
  delete: no                 # Removes matched items from the library and from the disk. Default: no
  format: format_item        # A specific format with which to print every track or album.
                             # This uses the same template syntax as beets’ path formats.
                             # The usage is inspired by, and therefore similar to, the list command.
                             # Default: format_item
  full: yes                  # List every track or album that has duplicates, not just the duplicates themselves. Default: no
  keys: [mb_trackid, mb_albumid]
                             # Define in which track or album fields duplicates are to be searched.
                             # By default, the plugin uses the musicbrainz track and album IDs for this purpose.
                             # Using the keys option (as a YAML list in the configuration file,
                             # or as space-delimited strings in the command-line),
                             # you can extend this behavior to consider other attributes.
                             # Default: [mb_trackid, mb_albumid]
  merge: no                  # Merge duplicate items by consolidating tracks and/or metadata where possible.
  move: none                 # A destination base directory into which it will move matched items. Default: none (disabled).
  path: no                   # Output the path instead of metadata when listing duplicates. Default: no.
  strict: no                 # Do not report duplicate matches if some of the attributes are not defined (ie. null or empty). Default: no
  #tag: no                   # A key=value pair.
                             # The plugin will add a new key attribute with value value as a flexattr to the database for duplicate items. Default: no.
  tiebreak: {}               # Dictionary of lists of attributes keyed by items or albums to use when choosing duplicates.
                             # By default, the tie-breaking procedure favors the most complete metadata attribute set.
                             # If you would like to consider the lower bitrates as duplicates, for example, set tiebreak: items: [bitrate].
                             # Default: {}.

check:
  import: yes                # Add checksums for new files during the import process.
                             # This also disables integrity checks on import and will not ask you to skip the import of corrupted files.
  write-check: yes           # Verify checksums before writing files with beet write or beet modify.
  write-update: yes          # Update checksums after writing files with beet write or beet modify.
  convert-update: no         # Update the checksum if a file has been converted with the --keep-new flag.
  threads: 1                 # Threads to compute checksums.

missing:
  #format: \$albumartist - \$album - \$title
                             # A specific format with which to print every track.
                             # This uses the same template syntax as beets’ path formats.
                             # The usage is inspired by, and therefore similar to, the list command.
                             # Default: format_item.
  count: yes                 # Print a count of missing tracks per album, with format defaulting to \$albumartist - \$album: \$missing.
                             # Default: no.
  total: yes                 # Print a single count of missing tracks in all albums.
                             # Default: no.

EOF
}
conf_print_beets_conf_9 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_10() {
	cat <<EOF
###################################################################################################
# Export ##########################################################################################

convert:                      # By default, the command places converted files into the destination directory and leaves your library pristine.
  auto: no                    # Import transcoded versions of your files automatically during imports.
  command: ffmpeg -i \$source -sample_fmt s16 -ar 44100 \$dest
  extension: flac
  source: /mnt/external/work/roon-export
  dest: /mnt/external/work/converted
                              # The directory where the files will be converted (or copied) to. Default: none.
                              # With this option enabled, the importer will transcode all (in the default configuration) non-MP3 files
                              # over the maximum bitrate before adding them to your library.
  #tmpdir: none               # The directory where temporary files will be stored during import. Default: none (system default),
  copy_album_art: no          # Since the covers are embedded in the files when Roon exports them, this configuration is not necessary.
  embed: no                   # Embed album art in converted items. Default: yes.
  #id3v23: inherit            # Can be used to override the global id3v23 option. Default: inherit.
  never_convert_lossy_files: yes
                              # Cross-conversions between lossy codecs—such as mp3, ogg vorbis, etc.
                              # Makes little sense as they will decrease quality even further.
                              # If set to yes, lossy files are always copied.
  quiet: false                # Prevent the plugin from announcing every file it processes.
                              # Default: false.
  threads: 1                  # The number of threads to use for parallel encoding.
                              # By default, the plugin will detect the number of processors available and use them all. 

permissions: # octal modes    # Maybe nescessary for smb shares like ROCK or NAS drives.
  file: 777
  dir: 777

EOF
}
conf_print_beets_conf_10 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_11() {
	cat <<EOF
###################################################################################################
# UI ##############################################################################################

verbose: no

ui:
  color: yes
  colors:
      text_success: green
      text_warning: blue
      text_error: red
      text_highlight: blue
      text_highlight_minor: lightgray
      action_default: darkblue
      action: purple

hook:
  hooks:
    #############################################
    - event: album_imported
      command: echo "\"{album}\""
    - event: import
      command: echo "imported from {paths}"
    #############################################
    - event: art_set
      command: echo "Coverart saved"
    - event: import_begin
      command: echo "Roon import started..."
    - event: import_task_apply
      command: echo "Metadata applied"
    - event: item_copied
      command: echo "\"{item}\" copied from \"{source}\" to \"{destination}\""
    - event: item_moved
      command: echo "Moved \"{item}\""
    - event: write
      command: echo "Writing to {path}"
    - event: cli_exit
      command: echo "All tasks finished!"


EOF
}
conf_print_beets_conf_11 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_conf_2() {
	cat <<EOF
###################################################################################################
# Paths ###########################################################################################

asciify_path: yes            # Convert all non-ASCII characters in paths to ASCII equivalents.

clutter:                     # When beets imports all the files in a directory, it tries to remove the directory if it’s empty.
                             # A directory is considered empty if it only contains files whose names match the glob patterns in clutter,
                             # which should be a list of strings.
                             # The importer only removes recursively searched subdirectories—the top-level directory you specify on the command line is never deleted.
  [
  .DS_Store,                 # Default.
  Thumbs.DB                  # Default.
  ]

bucket:
  bucket_alpha_regex:
    [A-Z]                    # Create folders with the first letters of the band names.

paths:                       # Directory and naming scheme.
                             # The aunique{} function ensures that identically-named albums are placed in different directories.
  default: %bucket{\$artist,alpha}/\$albumartist/\$album%aunique{}/\$track \$title
  singleton: %bucket{\$artist,alpha}/\$artist/Non-Album/\$title
  albumtype:soundtrack: Soundtracks/\$album%aunique{}/\$track \$title
  comp: Compilations/\$album%aunique{}/\$track \$title

  # copyartifacts ###############################
  ext:jpg: \$albumpath/scans/cover
  ext:png: \$albumpath/scans/cover
  ext:pdf: \$albumpath/scans/booklet
  ###############################################

max_filename_length: 255     # 0 = unlimited.

##################################################################################################
EOF
}
conf_print_beets_conf_2 | tee -a ${DEST}/.config/beets/config.yaml >/dev/null

conf_print_beets_plugins_conf() {
	cat <<-EOF
		# List of useful plugins.
		# Commented out (#) plugins are not in use yet.

		plugins:
		    [
		    #absubmit,       # Lets you submit acoustic analysis results to the AcousticBrainz server.
		                     # ToDo: install the extractor binary from https://acousticbrainz.org/download
		    acousticbrainz,  # Gets acoustic-analysis information from the AcousticBrainz project.
		    badfiles,        # ToDo. Adds a beet bad command to check for missing and corrupt files.
		    bandcamp,        # Beetcamp. Use bandcamp as an autotagger source for eg. artwork and lyrics.
		    bucket,          # Groups your files into buckets folders representing ranges.
		    chroma,          # Chromaprint/Acoustid Plugin.
		    check,           # Add checksum automatically.
		    convert,         # Lets you transcoding audio and embedding album art.
		    copyartifacts,   # A plugin that moves non-music files during the import process.
		    duplicates,      # Adds a new command, duplicates or dup, which finds and lists duplicate tracks or albums in your collection.
		    edit,            # Lets you modify music metadata using your favorite text editor. ToDo: No config file yet.
		    embedart,        # Embed the album art directly into each file’s metadata.
		    export,          # Lets you get data from the items and export the content as JSON, CSV, or XML.
		    fetchart,        # Retrieves album art images from various sources on the Web and stores them as image files.
		    follow,          # Get notifications about new releases from album artists in your Beets library using muspy.
		    fromfilename,    # The FromFilename plugin adds the ability to guess tags from the filenames.
		                     # Use this plugin if your tracks have useful names (like “03 Call Me Maybe.mp3”) but their tags don’t reflect that.
		    hook,            # Lets you run commands in response to these events.
		    importadded,     # Useful when an existing collection is imported and the time when albums and items were added should be preserved.
		    info,            # The info plugin provides a command that dumps the current tag values for any file format supported by beets.
		    lastimport,      # Doesn't write tags to files - only database. So not useful at the moment.
		    lastgenre,       # Fetches tags from Last.fm and assigns them as genres to your albums and items.
		    lyrics,          # Fetches and stores song lyrics from databases on the Web.
		    mbcollection,    # Lets you submit your catalog to MusicBrainz to maintain your music collection list there.
		    mbsubmit,        # Provides an extra prompt choice during an import session that prints the tracks
		                     # of the current album in a format that is parseable by MusicBrainz’s track parser.
		    mbsync,          # This plugin provides the mbsync command,
		                     # which lets you fetch metadata from MusicBrainz for albums and tracks that already have MusicBrainz IDs.
		    missing,         # This plugin adds a new command, missing or miss,
		                     # which finds and lists, for every album in your collection, which or how many tracks are missing.
		    parentwork,      # Fetches the work title, parent work title and parent work composer from MusicBrainz.
		    permissions,     # Set file permissions for imported music files and its directories. Permissions will be adjusted automatically on import.
		    replaygain,      # This plugin adds support for ReplayGain, a technique for normalizing audio playback levels.
		    unimported       # Allows to list all files in the library folder which are not listed in the beets library database, including art files.
		    ]
	EOF
}
conf_print_beets_plugins_conf | tee ${DEST}/.config/beets/plugins.yaml >/dev/null

mkdir -p ${DEST}/.config/beets/genres

conf_print_beets_genres_txt() {
	cat <<-EOF
		2 tone
		2-step garage
		4-beat
		4x4 garage
		8-bit
		acapella
		acid
		acid breaks
		acid house
		acid jazz
		acid rock
		acoustic music
		acousticana
		adult contemporary music
		african popular music
		african rumba
		afrobeat
		aleatoric music
		alternative country
		alternative dance
		alternative hip hop
		alternative metal
		alternative rock
		ambient
		ambient house
		ambient music
		americana
		anarcho punk
		anti-folk
		apala
		ape haters
		arab pop
		arabesque
		arabic pop
		argentine rock
		ars antiqua
		ars nova
		art punk
		art rock
		ashiq
		asian american jazz
		australian country music
		australian hip hop
		australian pub rock
		austropop
		avant-garde
		avant-garde jazz
		avant-garde metal
		avant-garde music
		axé
		bac-bal
		bachata
		baggy
		baila
		baile funk
		baisha xiyue
		baithak gana
		baião
		bajourou
		bakersfield sound
		bakou
		bakshy
		bal-musette
		balakadri
		balinese gamelan
		balkan pop
		ballad
		ballata
		ballet
		bamboo band
		bambuco
		banda
		bangsawan
		bantowbol
		barbershop music
		barndance
		baroque
		baroque music
		baroque pop
		bass music
		batcave
		batucada
		batuco
		batá-rumba
		beach music
		beat
		beatboxing
		beautiful music
		bebop
		beiguan
		bel canto
		bend-skin
		benga
		berlin school of electronic music
		bhajan
		bhangra
		bhangra-wine
		bhangragga
		bhangramuffin
		big band
		big band music
		big beat
		biguine
		bihu
		bikutsi
		biomusic
		bitcore
		bitpop
		black metal
		blackened death metal
		blue-eyed soul
		bluegrass
		blues
		blues ballad
		blues-rock
		boogie
		boogie woogie
		boogie-woogie
		bossa nova
		brass band
		brazilian funk
		brazilian jazz
		breakbeat
		breakbeat hardcore
		breakcore
		breton music
		brill building pop
		britfunk
		british blues
		british invasion
		britpop
		broken beat
		brown-eyed soul
		brukdown
		brutal death metal
		bubblegum dance
		bubblegum pop
		bulerias
		bumba-meu-boi
		bunraku
		burger-highlife
		burgundian school
		byzantine chant
		ca din tulnic
		ca pe lunca
		ca trù
		cabaret
		cadence
		cadence rampa
		cadence-lypso
		café-aman
		cai luong
		cajun music
		cakewalk
		calenda
		calentanos
		calgia
		calypso
		calypso jazz
		calypso-style baila
		campursari
		canatronic
		candombe
		canon
		canrock
		cantata
		cante chico
		cante jondo
		canterbury scene
		cantiga
		cantique
		cantiñas
		canto livre
		canto nuevo
		canto popular
		cantopop
		canzone napoletana
		cape jazz
		capoeira music
		caracoles
		carceleras
		cardas
		cardiowave
		carimbó
		cariso
		carnatic music
		carol
		cartageneras
		cassette culture
		casséy-co
		cavacha
		caveman
		caña
		celempungan
		cello rock
		celtic
		celtic fusion
		celtic metal
		celtic punk
		celtic reggae
		celtic rock
		cha-cha-cha
		chakacha
		chalga
		chamamé
		chamber jazz
		chamber music
		chamber pop
		champeta
		changuí
		chanson
		chant
		charanga
		charanga-vallenata
		charikawi
		chastushki
		chau van
		chemical breaks
		chicago blues
		chicago house
		chicago soul
		chicano rap
		chicha
		chicken scratch
		children's music
		chillout
		chillwave
		chimurenga
		chinese music
		chinese pop
		chinese rock
		chip music
		cho-kantrum
		chongak
		chopera
		chorinho
		choro
		chouval bwa
		chowtal
		christian alternative
		christian black metal
		christian electronic music
		christian hardcore
		christian hip hop
		christian industrial
		christian metal
		christian music
		christian punk
		christian r&b
		christian rock
		christian ska
		christmas carol
		christmas music
		chumba
		chut-kai-pang
		chutney
		chutney soca
		chutney-bhangra
		chutney-hip hop
		chutney-soca
		chylandyk
		chzalni
		chèo
		cigányzene
		classic
		classic country
		classic female blues
		classic rock
		classical
		classical music
		classical music era
		clicks n cuts
		close harmony
		club music
		cocobale
		coimbra fado
		coladeira
		colombianas
		combined rhythm
		comedy
		comedy rap
		comedy rock
		comic opera
		comparsa
		compas direct
		compas meringue
		concert overture
		concerto
		concerto grosso
		congo
		conjunto
		contemporary christian
		contemporary christian music
		contemporary classical
		contemporary r&b
		contonbley
		contradanza
		cool jazz
		corrido
		corsican polyphonic song
		cothoza mfana
		country
		country blues
		country gospel
		country music
		country pop
		country r&b
		country rock
		country-rap
		countrypolitan
		couple de sonneurs
		coupé-décalé
		cowpunk
		cretan music
		crossover jazz
		crossover music
		crossover thrash
		crossover thrash metal
		crunk
		crunk&b
		crunkcore
		crust punk
		csárdás
		cuarteto
		cuban rumba
		cuddlecore
		cueca
		cumbia
		cumbia villera
		cybergrind
		dabka
		dadra
		daina
		dalauna
		dance
		dance music
		dance-pop
		dance-punk
		dance-rock
		dancehall
		dangdut
		danger music
		dansband
		danza
		danzón
		dark ambient
		dark cabaret
		dark pop
		darkcore
		darkstep
		darkwave
		de ascultat la servici
		de codru
		de dragoste
		de jale
		de pahar
		death industrial
		death metal
		death rock
		death/doom
		deathcore
		deathgrind
		deathrock
		deep funk
		deep house
		deep soul
		degung
		delta blues
		dementia
		desert rock
		desi
		detroit blues
		detroit techno
		dhamar
		dhimotiká
		dhrupad
		dhun
		digital hardcore
		dirge
		dirty dutch
		dirty rap
		dirty rap/pornocore
		dirty south
		disco
		disco house
		disco polo
		disney
		disney hardcore
		disney pop
		diva house
		divine rock
		dixieland
		dixieland jazz
		djambadon
		djent
		dodompa
		doina
		dombola
		dondang sayang
		donegal fiddle tradition
		dongjing
		doo wop
		doom metal
		doomcore
		downtempo
		drag
		dream pop
		drone doom
		drone metal
		drone music
		dronology
		drum and bass
		dub
		dub house
		dubanguthu
		dubstep
		dubtronica
		dunedin sound
		dunun
		dutch jazz
		décima
		early music
		east coast blues
		east coast hip hop
		easy listening
		electric blues
		electric folk
		electro
		electro backbeat
		electro hop
		electro house
		electro punk
		electro-industrial
		electro-swing
		electroclash
		electrofunk
		electronic
		electronic art music
		electronic body music
		electronic dance
		electronic luk thung
		electronic music
		electronic rock
		electronica
		electropop
		elevator music
		emo
		emo pop
		emo rap
		emocore
		emotronic
		enka
		epic doom metal
		epic metal
		eremwu eu
		ethereal pop
		ethereal wave
		euro
		euro disco
		eurobeat
		eurodance
		europop
		eurotrance
		eurourban
		exotica
		experimental music
		experimental noise
		experimental pop
		experimental rock
		extreme metal
		ezengileer
		fado
		falak
		fandango
		farruca
		fife and drum blues
		filk
		film score
		filmi
		filmi-ghazal
		finger-style
		fjatpangarri
		flamenco
		flamenco rumba
		flower power
		foaie verde
		fofa
		folk hop
		folk metal
		folk music
		folk pop
		folk punk
		folk rock
		folktronica
		forró
		franco-country
		freak-folk
		freakbeat
		free improvisation
		free jazz
		free music
		freestyle
		freestyle house
		freetekno
		french pop
		frenchcore
		frevo
		fricote
		fuji
		fuji music
		fulia
		full on
		funaná
		funeral doom
		funk
		funk metal
		funk rock
		funkcore
		funky house
		furniture music
		fusion jazz
		g-funk
		gaana
		gabba
		gabber
		gagaku
		gaikyoku
		gaita
		galant
		gamad
		gambang kromong
		gamelan
		gamelan angklung
		gamelan bang
		gamelan bebonangan
		gamelan buh
		gamelan degung
		gamelan gede
		gamelan kebyar
		gamelan salendro
		gamelan selunding
		gamelan semar pegulingan
		gamewave
		gammeldans
		gandrung
		gangsta rap
		gar
		garage rock
		garrotin
		gavotte
		gelugpa chanting
		gender wayang
		gending
		german folk music
		gharbi
		gharnati
		ghazal
		ghazal-song
		ghetto house
		ghettotech
		girl group
		glam metal
		glam punk
		glam rock
		glitch
		gnawa
		go-go
		goa
		goa trance
		gong-chime music
		goombay
		goregrind
		goshu ondo
		gospel music
		gothic metal
		gothic rock
		granadinas
		grebo
		gregorian chant
		grime
		grindcore
		groove metal
		group sounds
		grunge
		grupera
		guaguanbo
		guajira
		guasca
		guitarra baiana
		guitarradas
		gumbe
		gunchei
		gunka
		guoyue
		gwo ka
		gwo ka moderne
		gypsy jazz
		gypsy punk
		gypsybilly
		gyu ke
		habanera
		hajnali
		hakka
		halling
		hambo
		hands up
		hapa haole
		happy hardcore
		haqibah
		hard
		hard bop
		hard house
		hard rock
		hard trance
		hardcore hip hop
		hardcore metal
		hardcore punk
		hardcore techno
		hardstyle
		harepa
		harmonica blues
		hasaposérviko
		heart attack
		heartland rock
		heavy beat
		heavy metal
		hesher
		hi-nrg
		highlands
		highlife
		highlife fusion
		hillybilly music
		hindustani classical music
		hip hop
		hip hop & rap
		hip hop soul
		hip house
		hiplife
		hiragasy
		hiva usu
		hong kong and cantonese pop
		hong kong english pop
		honky tonk
		honkyoku
		hora lunga
		hornpipe
		horror punk
		horrorcore
		horrorcore rap
		house
		house music
		hua'er
		huasteco
		huayno
		hula
		humor
		humppa
		hunguhungu
		hyangak
		hymn
		hyphy
		hát chau van
		hát chèo
		hát cãi luong
		hát tuồng
		ibiza music
		icaro
		idm
		igbo music
		ijexá
		ilahije
		illbient
		impressionist music
		improvisational
		incidental music
		indian pop
		indie folk
		indie music
		indie pop
		indie rock
		indietronica
		indo jazz
		indo rock
		indonesian pop
		indoyíftika
		industrial death metal
		industrial hip-hop
		industrial metal
		industrial music
		industrial musical
		industrial rock
		instrumental rock
		intelligent dance music
		international latin
		inuit music
		iranian pop
		irish folk
		irish rebel music
		iscathamiya
		isicathamiya
		isikhwela jo
		island
		isolationist
		italo dance
		italo disco
		italo house
		itsmeños
		izvorna bosanska muzika
		j'ouvert
		j-fusion
		j-pop
		j-rock
		jaipongan
		jaliscienses
		jam band
		jam rock
		jamana kura
		jamrieng samai
		jangle pop
		japanese pop
		jarana
		jariang
		jarochos
		jawaiian
		jazz
		jazz blues
		jazz fusion
		jazz metal
		jazz rap
		jazz-funk
		jazz-rock
		jegog
		jenkka
		jesus music
		jibaro
		jig
		jig punk
		jing ping
		jingle
		jit
		jitterbug
		jive
		joged
		joged bumbung
		joik
		jonnycore
		joropo
		jota
		jtek
		jug band
		jujitsu
		juju
		juke joint blues
		jump blues
		jumpstyle
		jungle
		junkanoo
		juré
		jùjú
		k-pop
		kaba
		kabuki
		kachāshī
		kadans
		kagok
		kagyupa chanting
		kaiso
		kalamatianó
		kalattuut
		kalinda
		kamba pop
		kan ha diskan
		kansas city blues
		kantrum
		kantádhes
		kargyraa
		karma
		kaseko
		katajjaq
		kawachi ondo
		kayōkyoku
		ke-kwe
		kebyar
		kecak
		kecapi suling
		kertok
		khaleeji
		khap
		khelimaski djili
		khene
		khoomei
		khorovodi
		khplam wai
		khrung sai
		khyal
		kilapanda
		kinko
		kirtan
		kiwi rock
		kizomba
		klape
		klasik
		klezmer
		kliningan
		kléftiko
		kochare
		kolomyjka
		komagaku
		kompa
		konpa
		korean pop
		koumpaneia
		kpanlogo
		krakowiak
		krautrock
		kriti
		kroncong
		krump
		krzesany
		kuduro
		kulintang
		kulning
		kumina
		kun-borrk
		kundere
		kundiman
		kussundé
		kutumba wake
		kveding
		kvæði
		kwaito
		kwassa kwassa
		kwela
		käng
		kélé
		kĩkũyũ pop
		la la
		latin american
		latin jazz
		latin pop
		latin rap
		lavway
		laïko
		laïkó
		le leagan
		legényes
		lelio
		letkajenkka
		levenslied
		lhamo
		lieder
		light music
		light rock
		likanos
		liquid drum&bass
		liquid funk
		liquindi
		llanera
		llanto
		lo-fi
		lo-fi music
		loki djili
		long-song
		louisiana blues
		louisiana swamp pop
		lounge music
		lovers rock
		lowercase
		lubbock sound
		lucknavi thumri
		luhya omutibo
		luk grung
		lullaby
		lundu
		lundum
		m-base
		madchester
		madrigal
		mafioso rap
		maglaal
		magnificat
		mahori
		mainstream jazz
		makossa
		makossa-soukous
		malagueñas
		malawian jazz
		malhun
		maloya
		maluf
		maluka
		mambo
		manaschi
		mandarin pop
		manding swing
		mango
		mangue bit
		mangulina
		manikay
		manila sound
		manouche
		manzuma
		mapouka
		mapouka-serré
		marabi
		maracatu
		marga
		mariachi
		marimba
		marinera
		marrabenta
		martial industrial
		martinetes
		maskanda
		mass
		matamuerte
		math rock
		mathcore
		matt bello
		maxixe
		mazurka
		mbalax
		mbaqanga
		mbube
		mbumba
		medh
		medieval folk rock
		medieval metal
		medieval music
		meditation
		mejorana
		melhoun
		melhûn
		melodic black metal
		melodic death metal
		melodic hardcore
		melodic metalcore
		melodic music
		melodic trance
		memphis blues
		memphis rap
		memphis soul
		mento
		merengue
		merengue típico moderno
		merengue-bomba
		meringue
		merseybeat
		metal
		metalcore
		metallic hardcore
		mexican pop
		mexican rock
		mexican son
		meykhana
		mezwed
		miami bass
		microhouse
		middle of the road
		midwest hip hop
		milonga
		min'yo
		mineras
		mini compas
		mini-jazz
		minimal techno
		minimalist music
		minimalist trance
		minneapolis sound
		minstrel show
		minuet
		mirolóyia
		modal jazz
		modern classical
		modern classical music
		modern laika
		modern rock
		modinha
		mohabelo
		montuno
		monumental dance
		mor lam
		mor lam sing
		morna
		motorpop
		motown
		mozambique
		mpb
		mugam
		multicultural
		murga
		musette
		museve
		mushroom jazz
		music drama
		music hall
		musiqi-e assil
		musique concrète
		mutuashi
		muwashshah
		muzak
		méringue
		música campesina
		música criolla
		música de la interior
		música llanera
		música nordestina
		música popular brasileira
		música tropical
		nagauta
		nakasi
		nangma
		nanguan
		narcocorrido
		nardcore
		narodna muzika
		nasheed
		nashville sound
		nashville sound/countrypolitan
		national socialist black metal
		naturalismo
		nederpop
		neo soul
		neo-classical metal
		neo-medieval
		neo-prog
		neo-psychedelia
		neoclassical
		neoclassical metal
		neoclassical music
		neofolk
		neotraditional country
		nerdcore
		neue deutsche härte
		neue deutsche welle
		new age music
		new beat
		new instrumental
		new jack swing
		new orleans blues
		new orleans jazz
		new pop
		new prog
		new rave
		new romantic
		new school hip hop
		new taiwanese song
		new wave
		new wave of british heavy metal
		new wave of new wave
		new weird america
		new york blues
		new york house
		newgrass
		nganja
		nightcore
		nintendocore
		nisiótika
		no wave
		noh
		noise music
		noise pop
		noise rock
		nongak
		norae undong
		nordic folk dance music
		nordic folk music
		nortec
		norteño
		northern soul
		nota
		nu breaks
		nu jazz
		nu metal
		nu soul
		nueva canción
		nyatiti
		néo kýma
		obscuro
		oi!
		old school hip hop
		old-time
		oldies
		olonkho
		oltului
		ondo
		opera
		operatic pop
		oratorio
		orchestra
		orchestral
		organ trio
		organic ambient
		organum
		orgel
		oriental metal
		ottava rima
		outlaw country
		outsider music
		p-funk
		pagan metal
		pagan rock
		pagode
		paisley underground
		palm wine
		palm-wine
		pambiche
		panambih
		panchai baja
		panchavadyam
		pansori
		paranda
		parang
		parody
		parranda
		partido alto
		pasillo
		patriotic
		peace punk
		pelimanni music
		petenera
		peyote song
		philadelphia soul
		piano blues
		piano rock
		piedmont blues
		pimba
		pinoy pop
		pinoy rock
		pinpeat orchestra
		piphat
		piyyutim
		plainchant
		plena
		pleng phua cheewit
		pleng thai sakorn
		political hip hop
		polka
		polo
		polonaise
		pols
		polska
		pong lang
		pop
		pop folk
		pop music
		pop punk
		pop rap
		pop rock
		pop sunda
		pornocore
		porro
		post disco
		post-britpop
		post-disco
		post-grunge
		post-hardcore
		post-industrial
		post-metal
		post-minimalism
		post-punk
		post-rock
		post-romanticism
		pow-wow
		power electronics
		power metal
		power noise
		power pop
		powerviolence
		ppongtchak
		praise song
		program symphony
		progressive bluegrass
		progressive country
		progressive death metal
		progressive electronic
		progressive electronic music
		progressive folk
		progressive folk music
		progressive house
		progressive metal
		progressive power metal
		progressive rock
		progressive trance
		progressive thrash metal
		protopunk
		psych folk
		psychedelic music
		psychedelic pop
		psychedelic rock
		psychedelic trance
		psychobilly
		punk blues
		punk cabaret
		punk jazz
		punk rock
		punta
		punta rock
		qasidah
		qasidah modern
		qawwali
		quadrille
		quan ho
		queercore
		quiet storm
		rada
		raga
		raga rock
		ragga
		ragga jungle
		raggamuffin
		ragtime
		rai
		rake-and-scrape
		ramkbach
		ramvong
		ranchera
		rap
		rap metal
		rap rock
		rapcore
		rara
		rare groove
		rasiya
		rave
		raw rock
		raï
		rebetiko
		red dirt
		reel
		reggae
		reggae 110
		reggae bultrón
		reggae en español
		reggae fusion
		reggae highlife
		reggaefusion
		reggaeton
		rekilaulu
		relax music
		religious
		rembetiko
		renaissance music
		requiem
		rhapsody
		rhyming spiritual
		rhythm & blues
		rhythm and blues
		ricercar
		riot grrrl
		rock
		rock and roll
		rock en español
		rock opera
		rockabilly
		rocksteady
		rococo
		romantic flow
		romantic period in music
		rondeaux
		ronggeng
		roots reggae
		roots rock
		roots rock reggae
		rumba
		russian pop
		rímur
		sabar
		sacred harp
		sacred music
		sadcore
		saibara
		sakara
		salegy
		salsa
		salsa erotica
		salsa romantica
		saltarello
		samba
		samba-canção
		samba-reggae
		samba-rock
		sambai
		sanjo
		sato kagura
		sawt
		saya
		scat
		schlager
		schottisch
		schranz
		scottish baroque music
		screamo
		scrumpy and western
		sea shanty
		sean nós
		second viennese school
		sega music
		seggae
		seis
		semba
		sephardic music
		serialism
		set dance
		sevdalinka
		sevillana
		shabab
		shabad
		shalako
		shan'ge
		shango
		shape note
		shibuya-kei
		shidaiqu
		shima uta
		shock rock
		shoegaze
		shoegazer
		shoka
		shomyo
		show tune
		sica
		siguiriyas
		silat
		sinawi
		situational
		ska
		ska punk
		skacore
		skald
		skate punk
		skiffle
		slack-key guitar
		slide
		slowcore
		sludge metal
		slängpolska
		smooth jazz
		soca
		soft rock
		son
		son montuno
		son-batá
		sonata
		songo
		songo-salsa
		sophisti-pop
		soukous
		soul
		soul blues
		soul jazz
		soul music
		southern gospel
		southern harmony
		southern hip hop
		southern metal
		southern rock
		southern soul
		space age pop
		space music
		space rock
		spectralism
		speed garage
		speed metal
		speedcore
		spirituals
		spouge
		sprechgesang
		square dance
		squee
		st. louis blues
		stand-up
		steelband
		stoner metal
		stoner rock
		straight edge
		strathspeys
		stride
		string
		string quartet
		sufi music
		suite
		sunshine pop
		suomirock
		super eurobeat
		surf ballad
		surf instrumental
		surf music
		surf pop
		surf rock
		swamp blues
		swamp pop
		swamp rock
		swing
		swing music
		swingbeat
		sygyt
		symphonic
		symphonic black metal
		symphonic metal
		symphonic poem
		symphonic rock
		symphony
		synthcore
		synthpop
		synthpunk
		t'ong guitar
		taarab
		tai tu
		taiwanese pop
		tala
		talempong
		tambu
		tamburitza
		tamil christian keerthanai
		tango
		tanguk
		tappa
		tarana
		tarantella
		taranto
		tech
		tech house
		tech trance
		technical death metal
		technical metal
		techno
		technoid
		technopop
		techstep
		techtonik
		teen pop
		tejano
		tejano music
		tekno
		tembang sunda
		teutonic thrash metal
		texas blues
		thai pop
		thillana
		thrash metal
		thrashcore
		thumri
		tibetan pop
		tiento
		timbila
		tin pan alley
		tinga
		tinku
		toeshey
		togaku
		trad jazz
		traditional bluegrass
		traditional heavy metal
		traditional pop music
		trallalero
		trance
		tribal house
		trikitixa
		trip hop
		trip rock
		trip-hop
		tropicalia
		tropicalismo
		tropipop
		truck-driving country
		tumba
		turbo-folk
		turkish music
		turkish pop
		turntablism
		tuvan throat-singing
		twee pop
		twist
		two tone
		táncház
		uk garage
		uk pub rock
		unblack metal
		underground music
		uplifting
		uplifting trance
		urban cowboy
		urban folk
		urban jazz
		vallenato
		vaudeville
		venezuela
		verbunkos
		verismo
		viking metal
		villanella
		virelai
		vispop
		visual kei
		visual music
		vocal
		vocal house
		vocal jazz
		vocal music
		volksmusik
		waila
		waltz
		wangga
		warabe uta
		wassoulou
		weld
		were music
		west coast hip hop
		west coast jazz
		western
		western blues
		western swing
		witch house
		wizard rock
		women's music
		wong shadow
		wonky pop
		wood
		work song
		world fusion
		world fusion music
		world music
		worldbeat
		xhosa music
		xoomii
		yo-pop
		yodeling
		yukar
		yé-yé
		zajal
		zapin
		zarzuela
		zeibekiko
		zeuhl
		ziglibithy
		zouglou
		zouk
		zouk chouv
		zouklove
		zulu music
		zydeco
	EOF
}
conf_print_beets_genres_txt | tee ${DEST}/.config/beets/genres/genres.txt >/dev/null

conf_print_beets_genres_tree() {
	cat <<-EOF
		- african:
		    - african heavy metal
		    - african hip hop
		    - afrobeat
		    - apala
		    - benga
		    - bikutsi
		    - bongo flava
		    - cape jazz
		    - chimurenga
		    - coupé-décalé
		    - fuji music
		    - genge
		    - highlife
		    - hiplife
		    - isicathamiya
		    - jit
		    - jùjú
		    - kapuka
		    - kizomba
		    - kuduro
		    - kwaito
		    - kwela
		    - makossa
		    - maloya
		    - marrabenta
		    - mbalax
		    - mbaqanga
		    - mbube
		    - morna
		    - museve
		    - palm-wine
		    - raï
		    - sakara
		    - sega
		    - seggae
		    - semba
		    - soukous
		    - taarab
		    - zouglou
		- asian:
		    - east asian:
		        - anison
		        - c-pop
		        - cantopop
		        - enka
		        - hong kong english pop
		        - j-pop
		        - k-pop
		        - kayōkyoku
		        - korean pop
		        - mandopop
		        - onkyokei
		        - taiwanese pop
		    - fann at-tanbura
		    - fijiri
		    - khaliji
		    - liwa
		    - sawt
		    - south and southeast asian:
		        - baila
		        - bhangra
		        - bhojpuri
		        - dangdut
		        - filmi
		        - indian pop
		        - lavani
		        - luk thung:
		            - luk krung
		        - manila sound
		        - morlam
		        - pinoy pop
		        - pop sunda
		        - ragini
		        - thai pop
		- avant-garde:
		    - experimental music
		    - lo-fi
		    - musique concrète
		- blues:
		    - african blues
		    - blues rock
		    - blues shouter
		    - british blues
		    - canadian blues
		    - chicago blues
		    - classic female blues
		    - contemporary r&b
		    - country blues
		    - delta blues
		    - detroit blues
		    - electric blues
		    - gospel blues
		    - hill country blues
		    - hokum blues
		    - jazz blues
		    - jump blues
		    - kansas city blues
		    - louisiana blues
		    - memphis blues
		    - piano blues
		    - piedmont blues
		    - punk blues
		    - soul blues
		    - st. louis blues
		    - swamp blues
		    - texas blues
		    - west coast blues
		- caribbean and latin american:
		    - bachata
		    - baithak gana
		    - bolero
		    - brazilian:
		        - axé
		        - bossa nova
		        - brazilian rock
		        - brega
		        - choro
		        - forró
		        - frevo
		        - funk carioca
		        - lambada
		        - maracatu
		        - música popular brasileira
		        - música sertaneja
		        - pagode
		        - samba
		        - samba rock
		        - tecnobrega
		        - tropicalia
		        - zouk-lambada
		    - calypso
		    - chutney
		    - chutney soca
		    - compas
		    - mambo
		    - merengue
		    - méringue
		    - other latin:
		        - chicha
		        - criolla
		        - cumbia
		        - huayno
		        - mariachi
		        - ranchera
		        - tejano
		    - punta
		    - punta rock
		    - rasin
		    - reggaeton
		    - salsa
		    - soca
		    - son
		    - timba
		    - twoubadou
		    - zouk
		- classical:
		    - ballet
		    - baroque:
		        - baroque music
		    - cantata
		    - chamber music:
		        - string quartet
		    - classical music
		    - concerto:
		        - concerto grosso
		    - contemporary classical
		    - modern classical
		    - opera
		    - oratorio
		    - orchestra:
		        - orchestral
		        - symphonic
		        - symphony
		    - organum
		    - mass:
		        - requiem
		    - sacred music:
		        - cantique
		        - gregorian chant
		    - sonata
		- comedy:
		    - comedy music
		    - comedy rock
		    - humor
		    - parody music
		    - stand-up
		- country:
		    - alternative country:
		        - cowpunk
		    - americana
		    - australian country music
		    - bakersfield sound
		    - bluegrass:
		        - progressive bluegrass
		        - reactionary bluegrass
		    - blues country
		    - cajun:
		        - cajun fiddle tunes
		    - christian country music
		    - classic country
		    - close harmony
		    - country pop
		    - country rap
		    - country rock
		    - country soul
		    - cowboy/western music
		    - dansband music
		    - franco-country
		    - gulf and western
		    - hellbilly music
		    - hokum
		    - honky tonk
		    - instrumental country
		    - lubbock sound
		    - nashville sound
		    - neotraditional country
		    - outlaw country
		    - progressive country
		    - psychobilly/punkabilly
		    - red dirt
		    - rockabilly
		    - sertanejo
		    - texas country
		    - traditional country music
		    - truck-driving country
		    - western swing
		    - zydeco
		- easy listening:
		    - background music
		    - beautiful music
		    - elevator music
		    - furniture music
		    - lounge music
		    - middle of the road
		    - new-age music
		- electronic:
		    - ambient:
		        - ambient dub
		        - ambient house
		        - ambient techno
		        - dark ambient
		        - drone music
		        - illbient
		        - isolationism
		        - lowercase
		    - asian underground
		    - breakbeat:
		        - 4-beat
		        - acid breaks
		        - baltimore club
		        - big beat
		        - breakbeat hardcore
		        - broken beat
		        - florida breaks
		        - nu skool breaks
		    - chiptune:
		        - bitpop
		        - game boy music
		        - nintendocore
		        - video game music
		        - yorkshire bleeps and bass
		    - disco:
		        - cosmic disco
		        - disco polo
		            - euro disco
		        - italo disco
		        - nu-disco
		        - space disco
		    - downtempo:
		        - acid jazz
		        - balearic beat
		        - chill out
		        - dub music
		        - dubtronica
		        - ethnic electronica
		        - moombahton
		        - nu jazz
		        - trip hop
		    - drum and bass:
		        - darkcore
		        - darkstep
		        - drumfunk
		        - drumstep
		        - hardstep
		        - intelligent drum and bass
		        - jump-up
		        - liquid funk
		        - neurofunk
		        - oldschool jungle:
		            - darkside jungle
		            - ragga jungle
		        - raggacore
		        - sambass
		        - techstep
		    - electro:
		        - crunk
		        - electro backbeat
		        - electro-grime
		        - electropop
		    - electroacoustic:
		        - acousmatic music
		        - computer music
		        - electroacoustic improvisation
		        - field recording
		        - live coding
		        - live electronics
		        - soundscape composition
		        - tape music
		    - electronic rock:
		        - alternative dance:
		            - baggy
		            - madchester
		        - dance-punk
		        - dance-rock
		        - dark wave
		        - electroclash
		        - electronicore
		        - electropunk
		        - ethereal wave
		        - indietronica
		        - new rave
		        - space rock
		        - synthpop
		        - synthpunk
		    - electronica:
		        - berlin school
		        - chillwave
		        - electronic art music
		        - electronic dance music
		        - folktronica
		        - freestyle music
		        - glitch
		        - idm
		        - laptronica
		        - skweee
		        - sound art
		        - synthcore
		    - eurodance:
		        - bubblegum dance
		        - italo dance
		        - turbofolk
		    - hardcore:
		        - bouncy house
		        - bouncy techno
		        - breakcore
		        - digital hardcore
		        - doomcore
		        - dubstyle
		        - gabber
		        - happy hardcore
		        - hardstyle
		        - jumpstyle
		        - makina
		        - speedcore
		        - terrorcore
		        - uk hardcore
		    - hi-nrg:
		        - eurobeat
		        - hard nrg
		        - new beat
		    - house:
		        - acid house
		        - chicago house
		        - deep house
		        - diva house
		        - dutch house
		        - electro house
		        - freestyle house
		        - french house
		        - funky house
		        - ghetto house
		        - hardbag
		        - hip house
		        - italo house
		        - latin house
		        - minimal house
		        - progressive house
		        - rave music
		        - swing house
		        - tech house
		        - tribal house
		        - uk hard house
		        - us garage
		        - vocal house
		    - industrial:
		        - aggrotech
		        - coldwave
		        - cybergrind
		        - dark electro
		        - death industrial
		        - electro-industrial
		        - electronic body music:
		            - futurepop
		        - industrial metal:
		            - neue deutsche härte
		        - industrial rock
		        - noise:
		            - japanoise
		            - power electronics
		            - power noise
		        - witch house
		    - post-disco:
		        - boogie
		        - dance-pop
		    - progressive:
		        - progressive house/trance:
		            - disco house
		            - dream house
		            - space house
		        - progressive breaks
		        - progressive drum & bass
		        - progressive techno
		    - techno:
		        - acid techno
		        - detroit techno
		        - free tekno
		        - ghettotech
		        - minimal
		        - nortec
		        - schranz
		        - techno-dnb
		        - technopop
		        - tecno brega
		        - toytown techno
		    - trance:
		        - acid trance
		        - classic trance
		        - dream trance
		        - goa trance:
		            - dark psytrance
		            - full on
		            - psybreaks
		            - psyprog
		            - suomisaundi
		        - hard trance
		        - tech trance
		        - uplifting trance:
		            - orchestral uplifting
		        - vocal trance
		    - uk garage:
		        - 2-step
		        - 4x4
		        - bassline
		        - breakstep
		        - dubstep
		        - funky
		        - grime
		        - speed garage
		        - trap
		- folk:
		    - american folk revival
		    - anti-folk
		    - british folk revival
		    - celtic music
		    - contemporary folk
		    - filk music
		    - freak folk
		    - indie folk
		    - industrial folk
		    - neofolk
		    - progressive folk
		    - psychedelic folk
		    - sung poetry
		    - techno-folk
		- hip hop:
		    - alternative hip hop
		    - avant-garde hip hop
		    - chap hop
		    - christian hip hop
		    - conscious hip hop
		    - country-rap
		    - crunkcore
		    - cumbia rap
		    - east coast hip hop:
		        - brick city club
		        - hardcore hip hop
		        - mafioso rap
		        - new jersey hip hop
		    - electro music
		    - freestyle rap
		    - g-funk
		    - gangsta rap
		    - golden age hip hop
		    - hip hop soul
		    - hip pop
		    - hyphy
		    - industrial hip hop
		    - instrumental hip hop
		    - jazz rap
		    - low bap
		    - lyrical hip hop
		    - merenrap
		    - midwest hip hop:
		        - chicago hip hop
		        - detroit hip hop
		        - horrorcore
		        - st. louis hip hop
		        - twin cities hip hop
		    - motswako
		    - nerdcore
		    - new jack swing
		    - new school hip hop
		    - old school hip hop
		    - political hip hop
		    - rap opera
		    - rap rock:
		        - rap metal
		        - rapcore
		    - songo-salsa
		    - southern hip hop:
		        - atlanta hip hop:
		            - snap music
		        - bounce music
		        - houston hip hop:
		            - chopped and screwed
		        - miami bass
		    - turntablism
		    - underground hip hop
		    - urban pasifika
		    - west coast hip hop:
		        - chicano rap
		        - jerkin'
		- jazz:
		    - asian american jazz
		    - avant-garde jazz
		    - bebop
		    - boogie-woogie
		    - british dance band
		    - chamber jazz
		    - continental jazz
		    - cool jazz
		    - crossover jazz
		    - cubop
		    - dixieland
		    - ethno jazz
		    - european free jazz
		    - free funk
		    - free improvisation
		    - free jazz
		    - gypsy jazz
		    - hard bop
		    - jazz fusion
		    - jazz rock
		    - jazz-funk
		    - kansas city jazz
		    - latin jazz
		    - livetronica
		    - m-base
		    - mainstream jazz
		    - modal jazz
		    - neo-bop jazz
		    - neo-swing
		    - novelty ragtime
		    - orchestral jazz
		    - post-bop
		    - punk jazz
		    - ragtime
		    - shibuya-kei
		    - ska jazz
		    - smooth jazz
		    - soul jazz
		    - straight-ahead jazz
		    - stride jazz
		    - swing
		    - third stream
		    - trad jazz
		    - vocal jazz
		    - west coast gypsy jazz
		    - west coast jazz
		- other:
		    - worldbeat
		- pop:
		    - adult contemporary
		    - arab pop
		    - baroque pop
		    - bubblegum pop
		    - chanson
		    - christian pop
		    - classical crossover
		    - europop:
		        - austropop
		        - balkan pop
		        - french pop
		        - latin pop
		        - laïkó
		        - nederpop
		        - russian pop
		    - iranian pop
		    - jangle pop
		    - latin ballad
		    - levenslied
		    - louisiana swamp pop
		    - mexican pop
		    - motorpop
		    - new romanticism
		    - pop rap
		    - popera
		    - psychedelic pop
		    - schlager
		    - soft rock
		    - sophisti-pop
		    - space age pop
		    - sunshine pop
		    - surf pop
		    - teen pop
		    - traditional pop music
		    - turkish pop
		    - vispop
		    - wonky pop
		- rhythm and blues:
		    - funk:
		        - deep funk
		        - go-go
		        - p-funk
		    - soul:
		        - blue-eyed soul
		        - neo soul
		        - northern soul
		- rock:
		    - alternative rock:
		        - britpop:
		            - post-britpop
		        - dream pop
		        - grunge:
		            - post-grunge
		        - indie pop:
		            - dunedin sound
		            - twee pop
		        - indie rock
		        - noise pop
		        - nu metal
		        - post-punk revival
		        - post-rock:
		            - post-metal
		        - sadcore
		        - shoegaze
		        - slowcore
		    - art rock
		    - beat music
		    - chinese rock
		    - christian rock
		    - dark cabaret
		    - desert rock
		    - experimental rock
		    - folk rock
		    - garage rock
		    - glam rock
		    - hard rock
		    - heavy metal:
		        - alternative metal:
		            - funk metal
		        - black metal:
		            - viking metal
		        - christian metal
		        - death metal:
		            - death/doom
		            - goregrind
		            - melodic death metal
		            - technical death metal
		        - doom metal:
		            - epic doom metal
		            - funeral doom
		        - drone metal
		        - epic metal
		        - folk metal:
		            - celtic metal
		            - medieval metal
		            - pagan metal
		        - funk metal
		        - glam metal
		        - gothic metal
		        - industrial metal:
		            - industrial death metal
		        - metalcore:
		            - deathcore
		            - mathcore:
		                - djent
		            - synthcore
		        - neoclassical metal
		        - post-metal
		        - power metal:
		            - progressive power metal
		        - progressive metal
		        - sludge metal
		        - speed metal
		        - stoner rock:
		            - stoner metal
		        - symphonic metal
		        - thrash metal:
		            - crossover thrash
		            - groove metal
		            - progressive thrash metal
		            - teutonic thrash metal
		        - traditional heavy metal
		    - math rock
		    - new wave:
		        - world fusion
		    - paisley underground
		    - pop rock
		    - post-punk:
		        - gothic rock
		        - no wave
		        - noise rock
		    - power pop
		    - progressive rock:
		        - canterbury scene
		        - krautrock
		        - new prog
		        - rock in opposition
		    - psychedelic rock:
		        - acid rock
		        - freakbeat
		        - neo-psychedelia
		        - raga rock
		    - punk rock:
		        - anarcho punk:
		            - crust punk:
		                - d-beat
		        - art punk
		        - christian punk
		        - deathrock
		        - folk punk:
		            - celtic punk
		            - gypsy punk
		        - garage punk
		        - grindcore:
		            - crustgrind
		            - noisegrind
		        - hardcore punk:
		            - post-hardcore:
		                - emo:
		                    - screamo
		            - powerviolence
		            - street punk
		            - thrashcore
		        - horror punk
		        - oi!
		        - pop punk
		        - psychobilly
		        - riot grrrl
		        - ska punk:
		            - ska-core
		        - skate punk
		    - rock and roll
		    - southern rock
		    - sufi rock
		    - surf rock
		    - visual kei:
		        - nagoya kei
		- reggae:
		    - roots reggae
		    - reggae fusion
		    - reggae en español:
		        - spanish reggae
		        - reggae 110
		        - reggae bultrón
		        - romantic flow
		    - lovers rock
		    - raggamuffin:
		        - ragga
		    - dancehall
		    - ska:
		        - 2 tone
		        - dub
		        - rocksteady
	EOF
}
conf_print_beets_genres_tree | tee ${DEST}/.config/beets/genres/genres-tree.yaml >/dev/null

# Install beets-xtractor and essentia for classification
