mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Audio] Added [p]cache stats command (#861)
This commit is contained in:
parent
493a729c30
commit
23db0208d0
@ -44,7 +44,6 @@ youtube_dl_options = {
|
|||||||
'format': 'bestaudio/best',
|
'format': 'bestaudio/best',
|
||||||
'extractaudio': True,
|
'extractaudio': True,
|
||||||
'audioformat': "mp3",
|
'audioformat': "mp3",
|
||||||
'outtmpl': '%(id)s',
|
|
||||||
'nocheckcertificate': True,
|
'nocheckcertificate': True,
|
||||||
'ignoreerrors': True,
|
'ignoreerrors': True,
|
||||||
'quiet': True,
|
'quiet': True,
|
||||||
@ -195,7 +194,6 @@ class Playlist:
|
|||||||
is_admin,
|
is_admin,
|
||||||
is_mod))
|
is_mod))
|
||||||
|
|
||||||
|
|
||||||
# def __del__() ?
|
# def __del__() ?
|
||||||
|
|
||||||
def append_song(self, author, url):
|
def append_song(self, author, url):
|
||||||
@ -1192,18 +1190,20 @@ class Audio:
|
|||||||
dumped = self._dump_cache()
|
dumped = self._dump_cache()
|
||||||
await self.bot.say("Dumped {:.3f} MB of audio files.".format(dumped))
|
await self.bot.say("Dumped {:.3f} MB of audio files.".format(dumped))
|
||||||
|
|
||||||
@cache.command(name="minimum")
|
@cache.command(name='stats')
|
||||||
async def cache_minimum(self):
|
async def cache_stats(self):
|
||||||
"""Current minimum cache size, based on server count."""
|
"""Reports info about the cache.
|
||||||
await self.bot.say("The cache will be at least {:.3f} MB".format(
|
- Current size of the cache.
|
||||||
|
- Maximum cache size. User setting or minimum, whichever is higher.
|
||||||
|
- Minimum cache size. Automatically determined by number of servers Red is running on.
|
||||||
|
"""
|
||||||
|
await self.bot.say("Cache stats:\n"
|
||||||
|
"Current size: {:.2f} MB\n"
|
||||||
|
"Maximum: {:.1f} MB\n"
|
||||||
|
"Minimum: {:.1f} MB".format(self._cache_size(),
|
||||||
|
self._cache_max(),
|
||||||
self._cache_min()))
|
self._cache_min()))
|
||||||
|
|
||||||
@cache.command(name="size")
|
|
||||||
async def cache_size(self):
|
|
||||||
"""Current size of the cache."""
|
|
||||||
await self.bot.say("Cache is currently at {:.3f} MB.".format(
|
|
||||||
self._cache_size()))
|
|
||||||
|
|
||||||
@commands.group(pass_context=True, hidden=True, no_pm=True)
|
@commands.group(pass_context=True, hidden=True, no_pm=True)
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def disconnect(self, ctx):
|
async def disconnect(self, ctx):
|
||||||
@ -1564,7 +1564,6 @@ class Audio:
|
|||||||
self._delete_playlist(server, name)
|
self._delete_playlist(server, name)
|
||||||
await self.bot.say("Playlist deleted.")
|
await self.bot.say("Playlist deleted.")
|
||||||
|
|
||||||
|
|
||||||
@playlist.command(pass_context=True, no_pm=True, name="start")
|
@playlist.command(pass_context=True, no_pm=True, name="start")
|
||||||
async def playlist_start(self, ctx, name):
|
async def playlist_start(self, ctx, name):
|
||||||
"""Plays a playlist."""
|
"""Plays a playlist."""
|
||||||
@ -1832,7 +1831,6 @@ class Audio:
|
|||||||
is_admin = discord.utils.get(member.roles, name=admin_role) is not None
|
is_admin = discord.utils.get(member.roles, name=admin_role) is not None
|
||||||
is_mod = discord.utils.get(member.roles, name=mod_role) is not None
|
is_mod = discord.utils.get(member.roles, name=mod_role) is not None
|
||||||
|
|
||||||
|
|
||||||
nonbots = sum(not m.bot for m in member.voice_channel.voice_members)
|
nonbots = sum(not m.bot for m in member.voice_channel.voice_members)
|
||||||
alone = nonbots <= 1
|
alone = nonbots <= 1
|
||||||
|
|
||||||
@ -2199,6 +2197,7 @@ def check_files():
|
|||||||
"Adding " + str(key) + " field to audio settings.json")
|
"Adding " + str(key) + " field to audio settings.json")
|
||||||
dataIO.save_json(settings_path, current)
|
dataIO.save_json(settings_path, current)
|
||||||
|
|
||||||
|
|
||||||
def verify_ffmpeg_avconv():
|
def verify_ffmpeg_avconv():
|
||||||
try:
|
try:
|
||||||
subprocess.call(["ffmpeg", "-version"], stdout=subprocess.DEVNULL)
|
subprocess.call(["ffmpeg", "-version"], stdout=subprocess.DEVNULL)
|
||||||
@ -2214,6 +2213,7 @@ def verify_ffmpeg_avconv():
|
|||||||
else:
|
else:
|
||||||
return "avconv"
|
return "avconv"
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
check_folders()
|
check_folders()
|
||||||
check_files()
|
check_files()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user