mirror of
https://github.com/azlux/botamusique
synced 2024-11-23 22:06:09 +00:00
Compare commits
4 Commits
a034d2a85d
...
37666c7daf
Author | SHA1 | Date | |
---|---|---|---|
|
37666c7daf | ||
|
9ba27207ea | ||
|
763cc960a6 | ||
|
81b78fa8e3 |
@ -1148,6 +1148,11 @@ def cmd_shortlist(bot, user, text, command, parameter):
|
|||||||
|
|
||||||
def cmd_delete_from_library(bot, user, text, command, parameter):
|
def cmd_delete_from_library(bot, user, text, command, parameter):
|
||||||
global song_shortlist, log
|
global song_shortlist, log
|
||||||
|
|
||||||
|
if not var.config.getboolean("bot", "delete_allowed", fallback=True):
|
||||||
|
bot.mumble.users[text.actor].send_text_message(tr('not_admin'))
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
indexes = [int(i) for i in parameter.split(" ")]
|
indexes = [int(i) for i in parameter.split(" ")]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -18,108 +18,75 @@
|
|||||||
# ========================================================
|
# ========================================================
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
host = 127.0.0.1
|
|
||||||
port = 64738
|
|
||||||
password =
|
|
||||||
channel =
|
|
||||||
# example: token1,token2
|
|
||||||
tokens =
|
|
||||||
certificate =
|
certificate =
|
||||||
|
channel =
|
||||||
|
host = 127.0.0.1
|
||||||
|
password =
|
||||||
|
port = 64738
|
||||||
|
tokens =
|
||||||
|
|
||||||
|
|
||||||
[bot]
|
[bot]
|
||||||
username = botamusique
|
admin =
|
||||||
comment = "Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!"
|
|
||||||
avatar =
|
|
||||||
# default volume from 0 to 1.
|
|
||||||
volume = 0.1
|
|
||||||
stereo = True
|
|
||||||
# bandwidth used by the bot
|
|
||||||
bandwidth = 96000
|
|
||||||
# playback mode should be one of "one-shot", "repeat", "random", "autoplay"
|
|
||||||
playback_mode = one-shot
|
|
||||||
autoplay_length = 5
|
|
||||||
clear_when_stop_in_oneshot = False
|
|
||||||
|
|
||||||
# target version, stable/testing/git (testing needs to be installed with git)
|
|
||||||
target_version = git
|
|
||||||
|
|
||||||
# Users allowed to kill the bot, or ban URLs.
|
|
||||||
admin = User1;User2;
|
|
||||||
# Folder that stores your local songs.
|
|
||||||
music_folder = music_folder/
|
|
||||||
# Folder that stores the downloaded music.
|
|
||||||
tmp_folder = /tmp/
|
|
||||||
pip3_path = venv/bin/pip
|
|
||||||
auto_check_update = True
|
|
||||||
logfile =
|
|
||||||
|
|
||||||
# in MB, 0 for no cache, -1 for unlimited size
|
|
||||||
tmp_folder_max_size = 10
|
|
||||||
|
|
||||||
# how many times the bot will try to download an item
|
|
||||||
download_attempts = 2
|
|
||||||
|
|
||||||
ignored_folders = tmp
|
|
||||||
ignored_files = Thumbs.db
|
|
||||||
|
|
||||||
announce_current_music = True
|
|
||||||
allow_other_channel_message = False
|
allow_other_channel_message = False
|
||||||
allow_private_message = True
|
allow_private_message = True
|
||||||
|
announce_current_music = True
|
||||||
# 'save_music_library': If this is set True, the bot will save the metadata of music into the database.
|
auto_check_update = True
|
||||||
save_music_library = True
|
autoplay_length = 5
|
||||||
|
avatar =
|
||||||
# 'refresh_cache_on_startup': If this is set true, the bot will refresh its music directory cache when starting up.
|
bandwidth = 96000
|
||||||
# But it won't reload metadata from each files. If set to False, it will used the cache last time.
|
clear_when_stop_in_oneshot = False
|
||||||
refresh_cache_on_startup = True
|
comment = "Hi, I'm here to play radio, local music or youtube/soundcloud music. Have fun!"
|
||||||
|
database_path =
|
||||||
# If save_playlist is set True, the bot will save current
|
delete_allowed = True
|
||||||
# playlist before quitting and reload it the next time it start.
|
download_attempts = 2
|
||||||
save_playlist = True
|
|
||||||
|
|
||||||
# Maximum track played when a playlist is added.
|
|
||||||
max_track_playlist = 20
|
|
||||||
|
|
||||||
# Maximum music duration (minutes)
|
|
||||||
max_track_duration = 60
|
|
||||||
|
|
||||||
# If ducking is enabled, the bot will automatically attenuate its volume when someone is talking.
|
|
||||||
ducking = False
|
ducking = False
|
||||||
ducking_volume = 0.05
|
|
||||||
ducking_threshold = 3000
|
ducking_threshold = 3000
|
||||||
|
ducking_volume = 0.05
|
||||||
# if when_nobody_in_channel is enabled and the bot is left alone, action are make :
|
ignored_files = Thumbs.db
|
||||||
# "pause" (pause current song), "pause_resume" (pause current song and resume once somebody reenters the channel), "stop" (also clears playlist) or "nothing" (keep playing music)
|
ignored_folders = tmp
|
||||||
|
language = en_US
|
||||||
|
logfile =
|
||||||
|
max_track_duration = 60
|
||||||
|
max_track_playlist = 20
|
||||||
|
music_database_path =
|
||||||
|
music_folder = music_folder/
|
||||||
|
pip3_path = venv/bin/pip
|
||||||
|
playback_mode = one-shot
|
||||||
|
redirect_stderr = True
|
||||||
|
refresh_cache_on_startup = True
|
||||||
|
save_music_library = True
|
||||||
|
save_playlist = True
|
||||||
|
stereo = True
|
||||||
|
target_version = git
|
||||||
|
tmp_folder = /tmp/
|
||||||
|
tmp_folder_max_size = 10
|
||||||
|
username = botamusique
|
||||||
|
volume = 0.1
|
||||||
when_nobody_in_channel = nothing
|
when_nobody_in_channel = nothing
|
||||||
|
youtube_query_cookie =
|
||||||
|
|
||||||
[webinterface]
|
[webinterface]
|
||||||
# Set enabled to True if you'd like to use the web interface to manage your playlist, upload files, etc.
|
access_address = http://127.0.0.1:8181
|
||||||
|
auth_method = none
|
||||||
enabled = False
|
enabled = False
|
||||||
|
flask_secret = ChangeThisPassword
|
||||||
is_web_proxified = True
|
is_web_proxified = True
|
||||||
listening_addr = 127.0.0.1
|
listening_addr = 127.0.0.1
|
||||||
listening_port = 8181
|
listening_port = 8181
|
||||||
|
max_attempts = 10
|
||||||
|
max_upload_file_size = 30M
|
||||||
|
password =
|
||||||
|
upload_enabled = True
|
||||||
|
user =
|
||||||
web_logfile =
|
web_logfile =
|
||||||
|
|
||||||
auth_method = none
|
|
||||||
user =
|
|
||||||
password =
|
|
||||||
max_attempts = 10
|
|
||||||
|
|
||||||
access_address = http://127.0.0.1:8181
|
|
||||||
|
|
||||||
flask_secret = ChangeThisPassword
|
|
||||||
|
|
||||||
upload_enabled = True
|
|
||||||
max_upload_file_size = 30M
|
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
# Set ffmpeg to True if you want to display DEBUG level log of ffmpeg.
|
|
||||||
ffmpeg = False
|
ffmpeg = False
|
||||||
|
mumble_connection = False
|
||||||
redirect_ffmpeg_log = True
|
redirect_ffmpeg_log = True
|
||||||
mumbleConnection = False
|
|
||||||
youtube_dl = False
|
youtube_dl = False
|
||||||
|
|
||||||
# This is a list of default radio stations.
|
|
||||||
[radio]
|
[radio]
|
||||||
ponyville = http://192.99.131.205:8000/stream.mp3 "Here a command of !radio comment"
|
ponyville = http://192.99.131.205:8000/stream.mp3 "Here a command of !radio comment"
|
||||||
luna = http://radio.ponyvillelive.com:8002/stream "calm and orchestra music"
|
luna = http://radio.ponyvillelive.com:8002/stream "calm and orchestra music"
|
||||||
@ -127,82 +94,65 @@ radiobrony = http://62.210.138.34:8000/live "Brony music of a friend"
|
|||||||
jazz = http://jazz-wr04.ice.infomaniak.ch/jazz-wr04-128.mp3 "Jazz Yeah !"
|
jazz = http://jazz-wr04.ice.infomaniak.ch/jazz-wr04-128.mp3 "Jazz Yeah !"
|
||||||
|
|
||||||
[youtube_dl]
|
[youtube_dl]
|
||||||
|
cookie_file =
|
||||||
source_address =
|
source_address =
|
||||||
cookiefile =
|
|
||||||
user_agent =
|
user_agent =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# =========================================================
|
|
||||||
# WARNING: WE DO NOT SUGGEST YOU MODIFY THE FOLLOWING
|
|
||||||
# PARTS, EXCEPT IF YOU KNOW WHAT YOU ARE DOING.
|
|
||||||
# =========================================================
|
|
||||||
[commands]
|
[commands]
|
||||||
# This is a list of characters the bot recognizes as command prefix.
|
|
||||||
command_symbol = !:!
|
|
||||||
# This option split username, in case you use such kind of mumo plugins https://wiki.mumble.info/wiki/Mumo#Set_Status
|
|
||||||
split_username_at_space = False
|
|
||||||
|
|
||||||
|
|
||||||
play_file = file, f
|
|
||||||
play_file_match = filematch, fm
|
|
||||||
play_url = url
|
|
||||||
play_radio = radio
|
|
||||||
play_playlist = playlist
|
|
||||||
|
|
||||||
rb_query = rbquery
|
|
||||||
rb_play = rbplay
|
|
||||||
|
|
||||||
yt_search = ysearch
|
|
||||||
yt_play = yplay
|
|
||||||
|
|
||||||
help = help
|
|
||||||
pause = pause
|
|
||||||
play = p, play
|
|
||||||
stop = stop
|
|
||||||
remove = rm
|
|
||||||
clear = clear
|
|
||||||
skip = skip
|
|
||||||
last = last
|
|
||||||
current_music = np, now
|
|
||||||
volume = volume
|
|
||||||
kill = kill
|
|
||||||
stop_and_getout = oust
|
|
||||||
joinme = joinme
|
|
||||||
queue = queue
|
|
||||||
repeat = repeat
|
|
||||||
random = random
|
|
||||||
version = version
|
|
||||||
mode = mode
|
|
||||||
update = update
|
|
||||||
list_file = listfile
|
|
||||||
|
|
||||||
play_tag = tag
|
|
||||||
add_tag = addtag
|
|
||||||
remove_tag = untag
|
|
||||||
find_tagged = findtagged, ft
|
|
||||||
search = search
|
|
||||||
delete_from_library = delete
|
|
||||||
add_from_shortlist = shortlist, sl
|
add_from_shortlist = shortlist, sl
|
||||||
|
add_tag = addtag
|
||||||
user_ban = userban
|
add_webinterface_user = webuseradd
|
||||||
user_unban = userunban
|
change_user_password = password
|
||||||
url_ban = urlban
|
clear = clear
|
||||||
url_ban_list = urlbanlist
|
command_symbol = !:!
|
||||||
url_unban = urlunban
|
current_music = np, now
|
||||||
url_whitelist = urlwhitelist, urlw
|
delete_from_library = delete
|
||||||
url_unwhitelist = urlunwhitelist, urlunw
|
drop_database = dropdatabase
|
||||||
url_whitelist_list = urlwhitelistlist, urlwls
|
|
||||||
|
|
||||||
ducking = duck
|
ducking = duck
|
||||||
ducking_threshold = duckthres
|
ducking_threshold = duckthres
|
||||||
ducking_volume = duckv
|
ducking_volume = duckv
|
||||||
|
find_tagged = findtagged, ft
|
||||||
drop_database = dropdatabase
|
help = help
|
||||||
rescan = rescan
|
joinme = joinme
|
||||||
|
kill = kill
|
||||||
requests_webinterface_access = web
|
last = last
|
||||||
|
list_file = listfile
|
||||||
list_webinterface_user = webuserlist
|
list_webinterface_user = webuserlist
|
||||||
add_webinterface_user = webuseradd
|
mode = mode
|
||||||
|
pause = pause
|
||||||
|
play = p, play
|
||||||
|
play_file = file, f
|
||||||
|
play_file_match = filematch, fm
|
||||||
|
play_playlist = playlist
|
||||||
|
play_radio = radio
|
||||||
|
play_tag = tag
|
||||||
|
play_url = url
|
||||||
|
queue = queue
|
||||||
|
random = random
|
||||||
|
rb_play = rbplay
|
||||||
|
rb_query = rbquery
|
||||||
|
remove = rm
|
||||||
|
remove_tag = untag
|
||||||
remove_webinterface_user = webuserdel
|
remove_webinterface_user = webuserdel
|
||||||
change_user_password = password
|
repeat = repeat
|
||||||
|
requests_webinterface_access = web
|
||||||
|
rescan = rescan
|
||||||
|
search = search
|
||||||
|
skip = skip
|
||||||
|
split_username_at_space = False
|
||||||
|
stop = stop
|
||||||
|
stop_and_getout = oust
|
||||||
|
update = update
|
||||||
|
url_ban = urlban
|
||||||
|
url_ban_list = urlbanlist
|
||||||
|
url_unban = urlunban
|
||||||
|
url_unwhitelist = urlunwhitelist, urlunw
|
||||||
|
url_whitelist = urlwhitelist, urlw
|
||||||
|
url_whitelist_list = urlwhitelistlist, urlwls
|
||||||
|
user_ban = userban
|
||||||
|
user_unban = userunban
|
||||||
|
version = version
|
||||||
|
volume = volume
|
||||||
|
yt_play = yplay
|
||||||
|
yt_search = ysearch
|
||||||
|
|
||||||
|
@ -95,6 +95,11 @@ port = 64738
|
|||||||
#allow_other_channel_message = False
|
#allow_other_channel_message = False
|
||||||
#allow_private_message = True
|
#allow_private_message = True
|
||||||
|
|
||||||
|
# 'delete_allowed': Allow users to delete a file from the library (hard disk).
|
||||||
|
# Works both for command and web interface. After enabling this option, only
|
||||||
|
# admins are allowed to delete files.
|
||||||
|
#delete_allowded = True
|
||||||
|
|
||||||
# 'save_music_library': If this is set True, the bot will save the metadata of music into the database.
|
# 'save_music_library': If this is set True, the bot will save the metadata of music into the database.
|
||||||
#save_music_library = True
|
#save_music_library = True
|
||||||
|
|
||||||
@ -166,17 +171,16 @@ port = 64738
|
|||||||
# !! YOU NEED TO CHANGE IT IF auth_method IS 'token'!!
|
# !! YOU NEED TO CHANGE IT IF auth_method IS 'token'!!
|
||||||
# flask_secret = ChangeThisPassword
|
# flask_secret = ChangeThisPassword
|
||||||
|
|
||||||
# 'upload_enabled': Enable the upload function of the web interface.
|
# 'upload_enabled': Enable the upload function of the web interface. If disabled,
|
||||||
|
# only admins can upload files.
|
||||||
# 'maximum_upload_file_size': Unit can be 'B', 'KB', 'MB', 'GB', 'TB'.
|
# 'maximum_upload_file_size': Unit can be 'B', 'KB', 'MB', 'GB', 'TB'.
|
||||||
# 'delete_allowed': Allow users to delete a file from the library(hard disk).
|
|
||||||
#upload_enabled = True
|
#upload_enabled = True
|
||||||
#max_upload_file_size = 30MB
|
#max_upload_file_size = 30MB
|
||||||
#delete_allowded = True
|
|
||||||
|
|
||||||
# [debug] stores some debug settings.
|
# [debug] stores some debug settings.
|
||||||
[debug]
|
[debug]
|
||||||
#ffmpeg = False # Set ffmpeg to True if you want to display DEBUG level log of ffmpeg.
|
#ffmpeg = False # Set ffmpeg to True if you want to display DEBUG level log of ffmpeg.
|
||||||
#mumbleConnection = False # Set to True if you need to debug mumble connection (pymumble lib)
|
#mumble_connection = False # Set to True if you need to debug mumble connection (pymumble lib)
|
||||||
#youtube_dl = False # Set to True if you need debug log from youtube-dl
|
#youtube_dl = False # Set to True if you need debug log from youtube-dl
|
||||||
|
|
||||||
# [radio] is a list of default radio stations.
|
# [radio] is a list of default radio stations.
|
||||||
@ -189,8 +193,8 @@ port = 64738
|
|||||||
[youtube_dl]
|
[youtube_dl]
|
||||||
# source_address , use '::' to force ipv6, "0.0.0.0" to force ipv4, or put the ip addresse you want to use.
|
# source_address , use '::' to force ipv6, "0.0.0.0" to force ipv4, or put the ip addresse you want to use.
|
||||||
# source_address = '::'
|
# source_address = '::'
|
||||||
# cookiefile , path of the cookie file (usefull if you reach youtube limits https://github.com/ytdl-org/youtube-dl#http-error-429-too-many-requests-or-402-payment-required)
|
# cookie_file , path of the cookie file (usefull if you reach youtube limits https://github.com/ytdl-org/youtube-dl#http-error-429-too-many-requests-or-402-payment-required)
|
||||||
# cookiefile = '/tmp/cooke_ydl'
|
# cookie_file = '/tmp/cooke_ydl'
|
||||||
# user-agent allow the user to force the user-agent of youtube-dl
|
# user-agent allow the user to force the user-agent of youtube-dl
|
||||||
# user-agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0"
|
# user-agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0"
|
||||||
|
|
||||||
|
@ -563,8 +563,8 @@ def library_info():
|
|||||||
|
|
||||||
return jsonify(dict(
|
return jsonify(dict(
|
||||||
dirs=get_all_dirs(),
|
dirs=get_all_dirs(),
|
||||||
upload_enabled=var.config.getboolean("webinterface", "upload_enabled", fallback=True),
|
upload_enabled=var.config.getboolean("webinterface", "upload_enabled", fallback=True) or var.bot.is_admin(user),
|
||||||
delete_allowed=var.config.getboolean("webinterface", "delete_allowed", fallback=True),
|
delete_allowed=var.config.getboolean("bot", "delete_allowed", fallback=True) or var.bot.is_admin(user),
|
||||||
tags=tags,
|
tags=tags,
|
||||||
max_upload_file_size=max_upload_file_size
|
max_upload_file_size=max_upload_file_size
|
||||||
))
|
))
|
||||||
@ -609,7 +609,7 @@ def library():
|
|||||||
|
|
||||||
return redirect("./", code=302)
|
return redirect("./", code=302)
|
||||||
elif payload['action'] == 'delete':
|
elif payload['action'] == 'delete':
|
||||||
if var.config.getboolean("webinterface", "delete_allowed", fallback=True):
|
if var.config.getboolean("bot", "delete_allowed", fallback=True):
|
||||||
items = dicts_to_items(var.music_db.query_music(condition))
|
items = dicts_to_items(var.music_db.query_music(condition))
|
||||||
for item in items:
|
for item in items:
|
||||||
var.playlist.remove_by_id(item.id)
|
var.playlist.remove_by_id(item.id)
|
||||||
|
@ -170,9 +170,9 @@ class URLItem(BaseItem):
|
|||||||
'verbose': var.config.getboolean('debug', 'youtube_dl')
|
'verbose': var.config.getboolean('debug', 'youtube_dl')
|
||||||
}
|
}
|
||||||
|
|
||||||
cookie = var.config.get('youtube_dl', 'cookiefile', fallback=None)
|
cookie = var.config.get('youtube_dl', 'cookie_file', fallback=None)
|
||||||
if cookie:
|
if cookie:
|
||||||
ydl_opts['cookiefile'] = var.config.get('youtube_dl', 'cookiefile', fallback=None)
|
ydl_opts['cookiefile'] = var.config.get('youtube_dl', 'cookie_file', fallback=None)
|
||||||
|
|
||||||
user_agent = var.config.get('youtube_dl', 'user_agent', fallback=None)
|
user_agent = var.config.get('youtube_dl', 'user_agent', fallback=None)
|
||||||
if user_agent:
|
if user_agent:
|
||||||
|
@ -15,9 +15,9 @@ def get_playlist_info(url, start_index=0, user=""):
|
|||||||
'verbose': var.config.getboolean('debug', 'youtube_dl')
|
'verbose': var.config.getboolean('debug', 'youtube_dl')
|
||||||
}
|
}
|
||||||
|
|
||||||
cookie = var.config.get('youtube_dl', 'cookiefile', fallback=None)
|
cookie = var.config.get('youtube_dl', 'cookie_file', fallback=None)
|
||||||
if cookie:
|
if cookie:
|
||||||
ydl_opts['cookiefile'] = var.config.get('youtube_dl', 'cookiefile', fallback=None)
|
ydl_opts['cookiefile'] = var.config.get('youtube_dl', 'cookie_file', fallback=None)
|
||||||
|
|
||||||
user_agent = var.config.get('youtube_dl', 'user_agent', fallback=None)
|
user_agent = var.config.get('youtube_dl', 'user_agent', fallback=None)
|
||||||
if user_agent:
|
if user_agent:
|
||||||
|
31
mumbleBot.py
31
mumbleBot.py
@ -115,7 +115,7 @@ class MumbleBot:
|
|||||||
|
|
||||||
self.mumble = pymumble.Mumble(host, user=self.username, port=port, password=password, tokens=tokens,
|
self.mumble = pymumble.Mumble(host, user=self.username, port=port, password=password, tokens=tokens,
|
||||||
stereo=self.stereo,
|
stereo=self.stereo,
|
||||||
debug=var.config.getboolean('debug', 'mumbleConnection'),
|
debug=var.config.getboolean('debug', 'mumble_connection'),
|
||||||
certfile=certificate)
|
certfile=certificate)
|
||||||
self.mumble.callbacks.set_callback(pymumble.constants.PYMUMBLE_CLBK_TEXTMESSAGERECEIVED, self.message_received)
|
self.mumble.callbacks.set_callback(pymumble.constants.PYMUMBLE_CLBK_TEXTMESSAGERECEIVED, self.message_received)
|
||||||
|
|
||||||
@ -798,11 +798,28 @@ if __name__ == '__main__':
|
|||||||
# ======================
|
# ======================
|
||||||
|
|
||||||
config = configparser.ConfigParser(interpolation=None, allow_no_value=True)
|
config = configparser.ConfigParser(interpolation=None, allow_no_value=True)
|
||||||
|
default_config = configparser.ConfigParser(interpolation=None, allow_no_value=True)
|
||||||
var.config = config
|
var.config = config
|
||||||
parsed_configs = config.read([util.solve_filepath('configuration.default.ini'), util.solve_filepath(args.config)],
|
|
||||||
encoding='utf-8')
|
if len(default_config.read(
|
||||||
if len(parsed_configs) == 0:
|
util.solve_filepath('configuration.default.ini'),
|
||||||
logging.error('Could not read configuration from file \"{}\"'.format(args.config))
|
encoding='utf-8')) == 0:
|
||||||
|
logging.error("Could not read default configuration file 'configuration.default.ini', please check"
|
||||||
|
"your installation.")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
if len(config.read(
|
||||||
|
[util.solve_filepath('configuration.default.ini'), util.solve_filepath(args.config)],
|
||||||
|
encoding='utf-8')) == 0:
|
||||||
|
logging.error(f'Could not read configuration from file "{args.config}"')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
extra_configs = util.check_extra_config(config, default_config)
|
||||||
|
if extra_configs:
|
||||||
|
extra_str = ", ".join([f"'[{k}] {v}'" for (k, v) in extra_configs])
|
||||||
|
logging.error(f'Unexpected config items {extra_str} defined in your config file. '
|
||||||
|
f'This is likely caused by a recent change in the names of config items, '
|
||||||
|
f'or the removal of obsolete config items. Please refer to the changelog.')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# ======================
|
# ======================
|
||||||
@ -845,9 +862,9 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
sanitized_username = "".join([x if x.isalnum() else "_" for x in username])
|
sanitized_username = "".join([x if x.isalnum() else "_" for x in username])
|
||||||
var.settings_db_path = args.db if args.db is not None else util.solve_filepath(
|
var.settings_db_path = args.db if args.db is not None else util.solve_filepath(
|
||||||
config.get("bot", "database_path", fallback=f"settings-{sanitized_username}.db"))
|
config.get("bot", "database_path", fallback="") or f"settings-{sanitized_username}.db")
|
||||||
var.music_db_path = args.music_db if args.music_db is not None else util.solve_filepath(
|
var.music_db_path = args.music_db if args.music_db is not None else util.solve_filepath(
|
||||||
config.get("bot", "music_database_path", fallback="music.db"))
|
config.get("bot", "music_database_path", fallback="") or "music.db")
|
||||||
|
|
||||||
var.db = SettingsDatabase(var.settings_db_path)
|
var.db = SettingsDatabase(var.settings_db_path)
|
||||||
|
|
||||||
|
13
util.py
13
util.py
@ -561,3 +561,16 @@ def clear_tmp_folder(path, size):
|
|||||||
except (FileNotFoundError, OSError):
|
except (FileNotFoundError, OSError):
|
||||||
continue
|
continue
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def check_extra_config(config, template):
|
||||||
|
extra = []
|
||||||
|
|
||||||
|
for key in config.sections():
|
||||||
|
if key in ['radio']:
|
||||||
|
continue
|
||||||
|
for opt in config.options(key):
|
||||||
|
if not template.has_option(key, opt):
|
||||||
|
extra.append((key, opt))
|
||||||
|
|
||||||
|
return extra
|
@ -530,10 +530,9 @@ function displayLibraryControls(data) {
|
|||||||
|
|
||||||
if (data.delete_allowed) {
|
if (data.delete_allowed) {
|
||||||
$('#deleteAllowed').val('true');
|
$('#deleteAllowed').val('true');
|
||||||
$('.library-delete').show();
|
|
||||||
} else {
|
} else {
|
||||||
$('#uploadDisabled').val('false');
|
$('#deleteAllowed').val('false');
|
||||||
$('.library-delete').hide();
|
$('.library-delete').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataList = $('#upload-target-dirs');
|
const dataList = $('#upload-target-dirs');
|
||||||
|
@ -269,7 +269,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<button class="library-item-trash btn btn-danger btn-sm btn-space library-delete" type="button"
|
<button class="library-item-trash btn btn-danger btn-sm btn-space library-delete" type="button"
|
||||||
aria-label="{{ tr('remove_song_from_library') }}">
|
aria-label="{{ tr('remove_song_from_library') }}">
|
||||||
<i class="fas fa-trash-alt"></i>
|
<i class="fas fa-trash-alt" aria-hidden="true"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user