diff --git a/README.md b/README.md
index cf4df3a..f3bb0d3 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,7 @@ Predicted functionalities will be those people would expect from any classic mus
1. [Installation](#installation)
1. [Configuration](#configuration)
1. [Run the bot](#run-the-bot)
+1. [Operate the bot](#operate-the-bot)
1. [Update](#update)
1. [Known issues](#known-issues)
1. [Contributors](#contributors)
@@ -141,6 +142,13 @@ If you want information about auto-starting and auto-restarting of the bot, you
**For the detailed manual of using botamusique, please see the [wiki](https://github.com/azlux/botamusique/wiki).**
+### Operate the bot
+
+You can control the bot by both commands sent by text message and the web interface.
+
+By default, all commands start with `!`. You can type `!help` in the text message to see the full list of commands supported, or see the [wiki page](https://github.com/azlux/botamusique/wiki/Command-Help).
+
+The web interface can be used if you'd like an intuitive way of interacting with the bot. Through it is fairly straightforward, a walk-through can be found on the [wiki page](https://github.com/azlux/botamusique/wiki/Web-interface-walk-through).
### Update
@@ -169,6 +177,11 @@ Exception: Could not find opus library. Make sure it is installed.
```
You need to install the opus codec (not embedded in all system): `apt install libopus0`
+3. If you have a large amount of music files (>1000), it may take some time for the bot to boot, since
+it will build up the cache for the music library on booting. You may want to disable this auto-scanning by
+setting ``refresh_cache_on_startu=False`` in `[bot]` section and control the scanning manually by
+``!rescan`` command and the *Rescan Files* button on the web interface.
+
### Contributors
If you want to participate, You're welcome to fork and submit pull requests (fixes and new features).
diff --git a/configuration.default.ini b/configuration.default.ini
index 1478d03..38bd2ca 100644
--- a/configuration.default.ini
+++ b/configuration.default.ini
@@ -258,7 +258,7 @@ auto_paused = Use !play to resume music!
help =
Commands
Control
- - !play (or !p) [{num}] - resume from pausing / start to play (the num-th song is num is given)
+ - !play (or !p) [{num}] - resume from pausing / start to play (the num-th song is num if given)
- !pause - pause
- !stop - stop playing
- !skip - jump to the next song
@@ -276,25 +276,25 @@ help = Commands
- !now (or !np) - display the current song
- !queue - display items in the playlist
+ - !tag {tags} - add all items with tags {tags}, tags separated by ",".
- !file (or !f) {path/folder/index/keyword} - add a single file to the playlist by its path or index returned by !listfile
- !filematch (or !fm) {pattern} - add all files that match regex {pattern}
- !url {url} - add Youtube or SoundCloud music
- !playlist {url} [{offset}] - add all items in a Youtube or SoundCloud playlist, and start with the {offset}-th item
- - !tag {tags} - add all items with tags {tags}, tags separated by ",".
- - !shortlist (or !sl) {indexes} - add {indexes}-th item on the shortlist.
+ - !radio {url} - append a radio {url} to the playlist
+ - !rbquery {keyword} - query http://www.radio-browser.info for a radio station
+ - !rbplay {id} - play a radio station with {id} (eg. !rbplay 96746)
+ - !ysearch {keywords} - query youtube. Use !ysearch -n to turn the page.
+ - !yplay {keywords} - add the first search result of {keywords} into the playlist.
+ - !shortlist (or !sl) {indexes/*} - add {indexes}-th item (or all items if * is given) on the shortlist.
- !rm {num} - remove the num-th song on the playlist
- !repeat [{num}] - repeat current song {num} (1 by default) times.
- !random - randomize the playlist.
- - !radio {url} - append a radio {url} to the playlist
- - !listfile [{pattern}] - display list of available files (that match the regex pattern if {pattern} is given)
- - !rbquery {keyword} - query http://www.radio-browser.info for a radio station
- - !rbplay {id} - play a radio station with {id} (eg. !rbplay 96746)
- - !ysearch {keywords} - query youtube. Use !ytquery -n to turn the page.
- - !yplay {keywords} - add the first search result of {keywords} into the playlist.
Music Library
- !search {keywords} - find item with {keywords} in the music library, keywords separated by space.
+ - !listfile [{pattern}] - display list of available files (whose paths match the regex pattern if {pattern} is given)
- !addtag [{index}] {tags} - add {tags} to {index}-th(current song if {index} is omitted) item on the playlist, tags separated by ",".
- !addtag * {tags} - add {tags} to all items on the playlist.
- !untag [{index/*}] {tags}/* - remove {tags}/all tags from {index}-th(current song if {index} is omitted) item on the playlist.
@@ -312,7 +312,7 @@ admin_help = Admin command
- !update - update the bot
- !userban {user} - ban a user
- !userunban {user} - unban a user
- - !urlbanlist {url} - list banned url
+ - !urlbanlist - list banned url
- !urlban [{url}] - ban {url} (or current item's url by default) and remove this url from the library.
- !urlunban {url} - unban {url}
- !rescan {url} - rebuild local music file cache
diff --git a/media/cache.py b/media/cache.py
index 979c603..6834820 100644
--- a/media/cache.py
+++ b/media/cache.py
@@ -109,8 +109,8 @@ class MusicCache(dict):
self.log.info("library: rebuild directory cache")
files = util.get_recursive_file_list_sorted(var.music_folder)
for file in files:
- item = self.fetch(bot, item_id_generators['file'](path=file))
- if not item:
+ results = self.db.query_music(Condition().and_equal('path', file))
+ if not results:
item = item_builders['file'](bot, path=file)
self.log.debug("library: music save into database: %s" % item.format_debug_string())
self.db.insert_music(item.to_dict())