Change default local cache level (#5140)

* Change default local cache level

* Update the owner message as well
This commit is contained in:
jack1142 2021-06-17 05:04:31 +02:00 committed by GitHub
parent c3362f6eaa
commit be04ec1c86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 8 deletions

View File

@ -198,7 +198,7 @@ class AudioAPIInterface:
uri: str, uri: str,
notifier: Optional[Notifier], notifier: Optional[Notifier],
skip_youtube: bool = False, skip_youtube: bool = False,
current_cache_level: CacheLevel = CacheLevel.none(), current_cache_level: CacheLevel = CacheLevel.all(),
) -> List[str]: ) -> List[str]:
"""Return youtube URLS for the spotify URL provided.""" """Return youtube URLS for the spotify URL provided."""
youtube_urls = [] youtube_urls = []
@ -718,7 +718,7 @@ class AudioAPIInterface:
self, self,
ctx: commands.Context, ctx: commands.Context,
track_info: str, track_info: str,
current_cache_level: CacheLevel = CacheLevel.none(), current_cache_level: CacheLevel = CacheLevel.all(),
) -> Optional[str]: ) -> Optional[str]:
"""Call the Youtube API and returns the youtube URL that the query matched.""" """Call the Youtube API and returns the youtube URL that the query matched."""
track_url = await self.youtube_api.get_call(track_info) track_url = await self.youtube_api.get_call(track_info)

View File

@ -15,7 +15,7 @@ from redbot.core.commands import Cog
from redbot.core.data_manager import cog_data_path from redbot.core.data_manager import cog_data_path
from redbot.core.i18n import Translator, cog_i18n from redbot.core.i18n import Translator, cog_i18n
from ..utils import PlaylistScope from ..utils import CacheLevel, PlaylistScope
from . import abc, cog_utils, commands, events, tasks, utilities from . import abc, cog_utils, commands, events, tasks, utilities
from .cog_utils import CompositeMetaClass from .cog_utils import CompositeMetaClass
@ -95,7 +95,7 @@ class Audio(
schema_version=1, schema_version=1,
bundled_playlist_version=0, bundled_playlist_version=0,
owner_notification=0, owner_notification=0,
cache_level=0, cache_level=CacheLevel.all().value,
cache_age=365, cache_age=365,
daily_playlists=False, daily_playlists=False,
global_db_enabled=False, global_db_enabled=False,

View File

@ -260,10 +260,7 @@ See `[p]help audioset globalapi` for more information.
Access to this service is disabled by default and **requires you to explicitly opt-in** to start using it. Access to this service is disabled by default and **requires you to explicitly opt-in** to start using it.
An access token is **required** to use this API. To obtain this token you may join <https://discord.gg/red> and run `?audioapi register` in the #testing channel. An access token is **required** to use this API. To obtain this token you may join <https://discord.gg/red> and run `?audioapi register` in the #testing channel.
Note: by using this service you accept that your bot's IP address will be disclosed to the Cog-Creators organization and used only for the purpose of providing the Global API service. Note: by using this service you accept that your bot's IP address will be disclosed to the Cog-Creators organization and used only for the purpose of providing the Global API service."""
On a related note, it is highly recommended that you enable your local cache if you haven't yet.
To do so, run `[p]audioset cache 5`. This cache, which stores only metadata, will make repeated audio requests faster and further reduce the likelihood of YouTube rate-limiting your bot. Since it's only metadata the required disk space for this cache is expected to be negligible."""
) )
await send_to_owners_with_prefix_replaced(self.bot, msg) await send_to_owners_with_prefix_replaced(self.bot, msg)
await self.config.owner_notification.set(1) await self.config.owner_notification.set(1)