refactor: move music db into a separated file.

IMPORTANT NOTE:
The default database path has changed. It was database.db, but
now they ARE settings.db and music.db.

Database migration will detect music table in settings.db, and
move it out of settings.db.

To update from old version, you need to
 1. if you use your own db path settings in the command
    line or in configuration.ini, you don't have to change
    anything;
 1. or,if you use default database path, rename database.db
    into settings.db.
This commit is contained in:
Terry Geng
2020-05-13 10:43:40 +08:00
parent 4c27bb28a1
commit 40ea744e7f
7 changed files with 161 additions and 111 deletions

View File

@ -24,14 +24,30 @@ port = 64738
#username = botamusique
#comment = Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!
# 'music_folder': Folder that stores your local songs.
#music_folder = music_folder/
# 'database_path': The path of the database. The database will store things like your volume
# set by command !volume, your playback mode and your playlist, banned URLs, etc.
# This option will be overridden by command line arguments.
# 'music_database_path': The path of database that stores the music library. Can be disabled by
# setting 'save_music_library=False'
#database_path=settings.db
#music_database_path=music.db
# 'admin': Users allowed to kill the bot, or ban URLs. Separated by ';'
#admin = User1;User2;
# 'volume' is default volume from 0 to 1.
# This option will be overridden by value in the database.
#volume = 0.1
# 'playback_mode' defined the playback mode of the bot.
# it should be one of "one-shot" (remove item once played), "repeat" (looping through the playlist),
# or "random" (randomize the playlist), "autoplay" (randomly grab something from the music library).
# This option will be overridden by value in the database.
# it should be one of "one-shot" (remove item once played), "repeat" (looping through the playlist),
# or "random" (randomize the playlist), "autoplay" (randomly grab something from the music library).
# This option will be overridden by value in the database.
# 'autoplay_length': how many songs the autoplay mode fills the playlist
# 'clear_when_stop_in_oneshot': clear the playlist when stop the bot in one-shot mode.
#playback_mode = one-shot
@ -42,17 +58,6 @@ port = 64738
# stable will use simple bash with curl command to get releases, testing will follow github master branch with git commands
#target_version = stable
# 'admin': Users allowed to kill the bot, or ban URLs. Separated by ';'
#admin = User1;User2;
# 'music_folder': Folder that stores your local songs.
#music_folder = music_folder/
# 'database_path': The path of the database. The database will store things like your volume
# set by command !volume, your playback mode and your playlist, etc.
# This option will be overridden by command line arguments.
#database_path = database.db
# 'tmp_folder': Folder that stores the downloaded music.
# 'tmp_folder_max_size': in MB, 0 for no cache, -1 for unlimited size
# 'ignored_folders', 'ignored_files': files and folders that would be ignored during scanning.
@ -79,11 +84,11 @@ port = 64738
#save_music_library = True
# 'refresh_cache_on_startup': If this is set true, the bot will refresh its music directory cache when starting up.
# But it won't reload metadata from each files. If set to False, it will used the cache last time.
# But it won't reload metadata from each files. If set to False, it will used the cache last time.
#refresh_cache_on_startup = True
# 'save_playlist': If save_playlist is set True, the bot will save current playlist before quitting
# and reload it the next time it start. It requires save_music_library to be True to function.
# and reload it the next time it start. It requires save_music_library to be True to function.
#save_playlist = True
# 'max_track_playlist': Maximum track played when a playlist is added.
@ -93,24 +98,24 @@ port = 64738
#max_track_duration = 60
# 'ducking': If ducking is enabled, the bot will automatically attenuate its
# volume when someone is talking.
# volume when someone is talking.
#ducking = False
#ducking_volume = 0.05
#ducking_threshold = 3000
# 'when_nobody_in_channel': Specify what the bot should do if nobody is in the channel.
# Possible value of this options are:
# - "pause",
# - "pause_resume" (pause and resume once somebody re-enters the channel)
# - "stop" (also clears playlist)
# - "nothing" (do nothing)
# Possible value of this options are:
# - "pause",
# - "pause_resume" (pause and resume once somebody re-enters the channel)
# - "stop" (also clears playlist)
# - "nothing" (do nothing)
#when_nobody_in_channel = nothing
# [webinterface] stores settings related to the web interface.
[webinterface]
# 'enable': Set 'enabled' to True if you'd like to use the web interface to manage
# your playlist, upload files, etc.
# The web interface is disable by default for security and performance reason.
# your playlist, upload files, etc.
# The web interface is disable by default for security and performance reason.
#enabled = False
#listening_addr = 127.0.0.1
#listening_port = 8181
@ -148,7 +153,7 @@ port = 64738
# You may also customize commands recognized by the bot. For a full list of commands,
# see configuration.default.ini. Copy options you want to edit into this file.
# see configuration.default.ini. Copy options you want to edit into this file.
#play_file = file, f
#play_file_match = filematch, fm