DO NOT MERGE #3698

Closed
Drapersniper wants to merge 203 commits from C3-feature-audio-fixes into V3/develop
Drapersniper commented 2020-03-26 19:22:38 +01:00 (Migrated from github.com)

Simply using this as a simple visualization of conflicts and tests

Simply using this as a simple visualization of conflicts and tests
palmtree5 (Migrated from github.com) reviewed 2020-03-26 19:22:38 +01:00
tekulvw (Migrated from github.com) reviewed 2020-03-26 19:22:38 +01:00
Twentysix26 (Migrated from github.com) reviewed 2020-03-26 19:22:38 +01:00
aikaterna (Migrated from github.com) reviewed 2020-03-26 19:22:38 +01:00
Jackenmen (Migrated from github.com) requested changes 2020-05-20 04:51:46 +02:00
Jackenmen (Migrated from github.com) left a comment

Pretty much all of this is i18n stuff, there's more to come which I can't put in GitHub suggestions as they're not part of the diffs (I'll handle it later), @cog_i18n deco on the cog is also still needed.

// yes, I purposefully did the review on this PR - branch is the same but the diffs are bigger so I can put stuff in GH suggestions I wouldn't be able to otherwise.

Pretty much all of this is i18n stuff, there's more to come which I can't put in GitHub suggestions as they're not part of the diffs (I'll handle it later), `@cog_i18n` deco on the cog is also still needed. // yes, I purposefully did the review on this PR - branch is the same but the diffs are bigger so I can put stuff in GH suggestions I wouldn't be able to otherwise.
@ -0,0 +318,4 @@
else:
break
except KeyError:
raise SpotifyFetchError(
Jackenmen (Migrated from github.com) commented 2020-05-20 04:09:30 +02:00

THIS IS PART 4/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

                    _("This doesn't seem to be a valid Spotify playlist/album URL or code.")
THIS IS PART 4/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion _("This doesn't seem to be a valid Spotify playlist/album URL or code.") ```
@ -0,0 +584,4 @@
single_track,
ctx.author,
)
Jackenmen (Migrated from github.com) commented 2020-05-20 04:07:01 +02:00

THIS IS PART 2/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

                    )
THIS IS PART 2/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion ) ```
@ -0,0 +760,4 @@
elif val and not forced and isinstance(val, dict):
data = val
data["query"] = query_string
if data.get("loadType") == "V2_COMPACT":
Jackenmen (Migrated from github.com) commented 2020-05-20 04:09:18 +02:00

THIS IS PART 3/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

oof, I can't make a suggestion cause it's not part of the changes, GitHub why...

You need to replace ( with _( line below the one I commented on

THIS IS PART 3/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS. *oof, I can't make a suggestion cause it's not part of the changes, GitHub why...* You need to replace `(` with `_(` line below the one I commented on
Jackenmen (Migrated from github.com) commented 2020-05-19 18:21:46 +02:00

This file is not used for anything (other than import of it in audio/apis/__init__.py)

This file is not used for anything (other than import of it in `audio/apis/__init__.py`)
@ -0,0 +1,189 @@
import base64
Jackenmen (Migrated from github.com) commented 2020-05-20 04:04:18 +02:00

THIS IS PART 1/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

                    message=_(
                        "The Spotify API key or client secret has not been set properly. "
                        "\nUse `{prefix}audioset spotifyapi` for instructions."
                    )
THIS IS PART 1/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion message=_( "The Spotify API key or client secret has not been set properly. " "\nUse `{prefix}audioset spotifyapi` for instructions." ) ```
Jackenmen (Migrated from github.com) commented 2020-05-20 04:17:22 +02:00

THIS IS PART 8/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

from redbot.core.i18n import Translator
from redbot.core.utils import AsyncIter

from redbot.core import Config
from redbot.core.bot import Red
from redbot.core.commands import Cog, Context

from ..errors import SpotifyFetchError

if TYPE_CHECKING:
    from .. import Audio

_ = Translator("Audio", __file__)

log = logging.getLogger("red.cogs.Audio.api.Spotify")
THIS IS PART 8/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion from redbot.core.i18n import Translator from redbot.core.utils import AsyncIter from redbot.core import Config from redbot.core.bot import Red from redbot.core.commands import Cog, Context from ..errors import SpotifyFetchError if TYPE_CHECKING: from .. import Audio _ = Translator("Audio", __file__) log = logging.getLogger("red.cogs.Audio.api.Spotify") ```
@ -25,50 +27,47 @@ __all__ = [
"get_playlist_converter",
Jackenmen (Migrated from github.com) commented 2020-05-20 04:37:09 +02:00

THIS IS PART 1/3 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

T_ = _
_ = lambda s: s

_SCOPE_HELP: Final[str] = _(
    """
Scope must be a valid version of one of the following:
​ ​ ​ ​ Global
​ ​ ​ ​ Guild
​ ​ ​ ​ User
"""
)
THIS IS PART 1/3 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion T_ = _ _ = lambda s: s _SCOPE_HELP: Final[str] = _( """ Scope must be a valid version of one of the following: ​ ​ ​ ​ Global ​ ​ ​ ​ Guild ​ ​ ​ ​ User """ ) ```
Jackenmen (Migrated from github.com) commented 2020-05-20 04:38:42 +02:00

THIS IS PART 3/3 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

_GUILD_HELP: Final[str] = _(
    """
Guild must be a valid version of one of the following:
​ ​ ​ ​ Guild ID
​ ​ ​ ​ Exact guild name
"""

_ = T_
THIS IS PART 3/3 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion _GUILD_HELP: Final[str] = _( """ Guild must be a valid version of one of the following: ​ ​ ​ ​ Guild ID ​ ​ ​ ​ Exact guild name """ _ = T_ ```
Jackenmen (Migrated from github.com) commented 2020-05-20 04:39:02 +02:00

THIS IS PART 2/3 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

_USER_HELP: Final[str] = _(
    """
Author must be a valid version of one of the following:
​ ​ ​ ​ User ID
​ ​ ​ ​ User Mention
​ ​ ​ ​ User Name#123
"""
THIS IS PART 2/3 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion _USER_HELP: Final[str] = _( """ Author must be a valid version of one of the following: ​ ​ ​ ​ User ID ​ ​ ​ ​ User Mention ​ ​ ​ ​ User Name#123 """ ```
@ -257,12 +275,12 @@ class ScopeParser(commands.Converter):
Jackenmen (Migrated from github.com) commented 2020-05-20 04:44:47 +02:00
            raise commands.ArgParserFailure("--scope", _("Nothing"), custom_help=_(_USER_HELP))
```suggestion raise commands.ArgParserFailure("--scope", _("Nothing"), custom_help=_(_USER_HELP)) ```
@ -438,3 +461,4 @@
from_user_raw = " ".join(from_author).strip()
try:
source_user = await global_unique_user_finder(
ctx, from_user_raw, guild=target_guild
Jackenmen (Migrated from github.com) commented 2020-05-20 04:46:16 +02:00
            raise commands.ArgParserFailure("--from-user", _("Nothing"), custom_help=_(_USER_HELP))
```suggestion raise commands.ArgParserFailure("--from-user", _("Nothing"), custom_help=_(_USER_HELP)) ```
@ -0,0 +1,1307 @@
import asyncio
Jackenmen (Migrated from github.com) commented 2020-05-20 03:48:32 +02:00
        msg += (
            "\n---"
            + _("Lavalink Settings")
            + "---        \n"
            + _("Cog version:      [{version}]\n")
            + _("Red-Lavalink:     [{lavalink_version}]\n")
            + _("External server:  [{use_external_lavalink}]\n")
        ).format(
            version=__version__,
            lavalink_version=lavalink.__version__,
            use_external_lavalink=_("Enabled")
            if global_data["use_external_lavalink"]
            else _("Disabled"),
        )
```suggestion msg += ( "\n---" + _("Lavalink Settings") + "--- \n" + _("Cog version: [{version}]\n") + _("Red-Lavalink: [{lavalink_version}]\n") + _("External server: [{use_external_lavalink}]\n") ).format( version=__version__, lavalink_version=lavalink.__version__, use_external_lavalink=_("Enabled") if global_data["use_external_lavalink"] else _("Disabled"), ) ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:50:52 +02:00
                    pscope = _("Server")
```suggestion pscope = _("Server") ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:50:59 +02:00
                    pscope = _("User")
```suggestion pscope = _("User") ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:51:06 +02:00
                    pscope = _("Global")
```suggestion pscope = _("Global") ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:52:05 +02:00
            discord.Embed(title=_("Blacklist"), description=page, colour=embed_colour)
```suggestion discord.Embed(title=_("Blacklist"), description=page, colour=embed_colour) ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:52:20 +02:00
            discord.Embed(title=_("Whitelist"), description=page, colour=embed_colour)
```suggestion discord.Embed(title=_("Whitelist"), description=page, colour=embed_colour) ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:52:32 +02:00
            discord.Embed(title=_("Global Blacklist"), description=page, colour=embed_colour)
```suggestion discord.Embed(title=_("Global Blacklist"), description=page, colour=embed_colour) ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:52:47 +02:00
            discord.Embed(title=_("Global Whitelist"), description=page, colour=embed_colour)
```suggestion discord.Embed(title=_("Global Whitelist"), description=page, colour=embed_colour) ```
@ -0,0 +1,385 @@
import asyncio
Jackenmen (Migrated from github.com) commented 2020-05-20 03:44:24 +02:00
                description=_("The {band_name}Hz band has been set to {band_value}.").format(
                    band_name=band_name, band_value=band_value
                ),
```suggestion description=_("The {band_name}Hz band has been set to {band_value}.").format( band_name=band_name, band_value=band_value ), ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:45:03 +02:00
            title=_("Current equalizer saved to the {preset_name} preset.").format(
                preset_name=eq_preset
            ),
```suggestion title=_("Current equalizer saved to the {preset_name} preset.").format( preset_name=eq_preset ), ```
@ -0,0 +1,861 @@
import contextlib
Jackenmen (Migrated from github.com) commented 2020-05-20 04:11:56 +02:00

THIS IS PART 7/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

                description=error.message.format(prefix=ctx.prefix),
THIS IS PART 7/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion description=error.message.format(prefix=ctx.prefix), ```
@ -0,0 +1,1951 @@
import asyncio
Jackenmen (Migrated from github.com) commented 2020-05-20 03:41:56 +02:00
                maxlength_msg = _(" {bad_tracks} tracks cannot be queued.").format(
```suggestion maxlength_msg = _(" {bad_tracks} tracks cannot be queued.").format( ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:43:00 +02:00
                name = _("Global")
```suggestion name = _("Global") ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:43:24 +02:00
            to_scope_name = _("the Global")
```suggestion to_scope_name = _("the Global") ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:43:31 +02:00
            from_scope_name = _("the Global")
```suggestion from_scope_name = _("the Global") ```
@ -0,0 +38,4 @@
)
raise RuntimeError(
"Not running audio command due to invalid machine architecture for Lavalink."
)
Jackenmen (Migrated from github.com) commented 2020-05-19 20:17:50 +02:00

Should this really raise a RuntimeError? IMO it's causing too much noise and it would be a lot better to just log it and raise CheckFailure right after to avoid unnecessary traceback in logs.

Should this really raise a `RuntimeError`? IMO it's causing too much noise and it would be a lot better to just log it and raise `CheckFailure` right after to avoid unnecessary traceback in logs.
@ -0,0 +1,49 @@
import logging
Jackenmen (Migrated from github.com) commented 2020-05-19 22:20:40 +02:00

I guess that considering there's no place where asyncio could do a context switch, this is fine, but imo it would be clearer to define the asyncio.Event in __init__. All these 3 attributes are defined in ABC so defining session in __init__ would also make sense. As for cog_init_task, you could assign None to it in __init__ as you already check if it's not falsy in the cog_unload anyway.

I guess that considering there's no place where asyncio could do a context switch, this is fine, but imo it would be clearer to define the `asyncio.Event` in `__init__`. All these 3 attributes are defined in ABC so defining `session` in `__init__` would also make sense. As for `cog_init_task`, you could assign `None` to it in `__init__` as you already check if it's not falsy in the `cog_unload` anyway.
@ -0,0 +1,669 @@
import logging
Jackenmen (Migrated from github.com) commented 2020-05-20 03:38:27 +02:00
                maxlength_msg = _(" {bad_tracks} tracks cannot be queued.").format(
```suggestion maxlength_msg = _(" {bad_tracks} tracks cannot be queued.").format( ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:38:48 +02:00
                title=_("{skip_to_track} Tracks Skipped").format(skip_to_track=skip_to_track)
```suggestion title=_("{skip_to_track} Tracks Skipped").format(skip_to_track=skip_to_track) ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:40:31 +02:00
                    title=_("There are only {queuelen} songs currently queued.").format(
                        queuelen=len(player.queue)
                    ),
```suggestion title=_("There are only {queuelen} songs currently queued.").format( queuelen=len(player.queue) ), ```
Jackenmen (Migrated from github.com) commented 2020-05-20 04:10:50 +02:00

THIS IS PART 5/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

                    ctx, title=error.message.format(prefix=ctx.prefix)
THIS IS PART 5/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion ctx, title=error.message.format(prefix=ctx.prefix) ```
Jackenmen (Migrated from github.com) commented 2020-05-20 04:11:18 +02:00

THIS IS PART 6/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS.

                description=error.message.format(prefix=ctx.prefix),
THIS IS PART 6/8 THAT NEED TO BE APPLIED TOGETHER WITH THIS. ```suggestion description=error.message.format(prefix=ctx.prefix), ```
@ -0,0 +1,647 @@
import asyncio
Jackenmen (Migrated from github.com) commented 2020-05-20 03:36:03 +02:00
                msg = _(
                    "You do not have the permissions to manage "
                    "playlists in {scope} scope."
                ).format(scope=self.humanize_scope(scope, the=True))
```suggestion msg = _( "You do not have the permissions to manage " "playlists in {scope} scope." ).format(scope=self.humanize_scope(scope, the=True)) ```
@ -0,0 +1,165 @@
import logging
Jackenmen (Migrated from github.com) commented 2020-05-20 03:34:44 +02:00
            queue_list = _("__Too many songs in the queue, only showing the first 500__.\n\n")
```suggestion queue_list = _("__Too many songs in the queue, only showing the first 500__.\n\n") ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:36:46 +02:00
            text=_("Page {page_num}/{total_pages} | {num_tracks} tracks").format(
```suggestion text=_("Page {page_num}/{total_pages} | {num_tracks} tracks").format( ```
Jackenmen (Migrated from github.com) commented 2020-05-20 03:37:51 +02:00
            title=_("Queue for __{guild_name}__").format(guild=ctx.guild.name),
```suggestion title=_("Queue for __{guild_name}__").format(guild=ctx.guild.name), ```
@ -241,12 +289,16 @@ DO UPDATE
track_info = excluded.track_info,
Jackenmen (Migrated from github.com) commented 2020-05-20 01:24:41 +02:00

LIMIT shouldn't be specified in this query.

    last_updated < :maxage
`LIMIT` shouldn't be specified in this query. ```suggestion last_updated < :maxage ```
@ -306,12 +386,16 @@ DO UPDATE
track_info = excluded.track_info,
last_updated = excluded.last_updated;
Jackenmen (Migrated from github.com) commented 2020-05-20 01:24:24 +02:00

LIMIT shouldn't be specified in this query.

    last_updated < :maxage
`LIMIT` shouldn't be specified in this query. ```suggestion last_updated < :maxage ```
@ -366,12 +478,16 @@ DO UPDATE
data = excluded.data,
last_updated = excluded.last_updated;
"""
Jackenmen (Migrated from github.com) commented 2020-05-20 01:22:26 +02:00

LIMIT shouldn't be specified in this query.

    last_updated < :maxage
`LIMIT` shouldn't be specified in this query. ```suggestion last_updated < :maxage ```
Drapersniper (Migrated from github.com) reviewed 2020-05-20 10:10:55 +02:00
@ -0,0 +70,4 @@
)
queue_list += f"`{track_idx}.` {track_description}, "
queue_list += _("requested by **{user}**\n").format(user=req_user)
Drapersniper (Migrated from github.com) commented 2020-05-20 10:10:54 +02:00
            title=_("Queue for __{guild_name}__").format(guild_name=ctx.guild.name),
```suggestion title=_("Queue for __{guild_name}__").format(guild_name=ctx.guild.name), ```
Jackenmen (Migrated from github.com) requested changes 2020-05-20 16:54:07 +02:00
Jackenmen (Migrated from github.com) left a comment

I did two things wrong in my suggestions :|

I did two things wrong in my suggestions :|
Jackenmen (Migrated from github.com) commented 2020-05-20 16:50:04 +02:00

omg, I missed a parenthesis

"""
)
omg, I missed a parenthesis ```suggestion """ ) ```
@ -0,0 +1,647 @@
import asyncio
Jackenmen (Migrated from github.com) commented 2020-05-20 16:52:49 +02:00

Black reformat, my suggestion failed style check :<

                    "You do not have the permissions to manage playlists in {scope} scope."
Black reformat, my suggestion failed style check :< ```suggestion "You do not have the permissions to manage playlists in {scope} scope." ```
Jackenmen (Migrated from github.com) reviewed 2020-05-20 17:02:29 +02:00
@ -77,7 +76,7 @@ async def global_unique_guild_finder(ctx: commands.Context, arg: str) -> discord
return guild
Jackenmen (Migrated from github.com) commented 2020-05-20 17:02:29 +02:00

I'm sorry Draper >.>

"""
)
I'm sorry Draper >.> ```suggestion """ ) ```
Drapersniper (Migrated from github.com) reviewed 2020-05-20 17:10:55 +02:00
@ -77,7 +76,7 @@ async def global_unique_guild_finder(ctx: commands.Context, arg: str) -> discord
return guild
Drapersniper (Migrated from github.com) commented 2020-05-20 17:10:55 +02:00

Don't worry I'm just pressing buttons

Don't worry I'm just pressing buttons
Jackenmen (Migrated from github.com) reviewed 2020-05-20 18:44:47 +02:00
@ -0,0 +1,10 @@
from . import (
Jackenmen (Migrated from github.com) commented 2020-05-20 18:44:47 +02:00

local_tracks needs to be removed.
Also, I have a question - why isn't this file just empty? Python should automatically resolve the redbot.core.audio.apis.submodule imports.

    local_db,
`local_tracks` needs to be removed. Also, I have a question - why isn't this file just empty? Python should automatically resolve the `redbot.core.audio.apis.submodule` imports. ```suggestion local_db, ```
Drapersniper (Migrated from github.com) reviewed 2020-05-20 19:10:58 +02:00
@ -0,0 +1,10 @@
from . import (
Drapersniper (Migrated from github.com) commented 2020-05-20 19:10:57 +02:00
```suggestion ```

Pull request closed

Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!3698
No description provided.