[Audio] One PR to rule them all, One PR to find them, One PR to bring them all, and in the darkness bind them (all-in-one pr) #2904

Merged
Drapersniper merged 359 commits from audiochanges into V3/develop 2019-10-11 04:09:01 +02:00
Drapersniper commented 2019-07-26 13:26:23 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

After discussing with @aikaterna she prefers everything in one PR so that conflicts and reviewing cross interaction and testing can be done more easily.

This PR will superseded #2861 and #2890, in addition to those 2 I've done a lot more work on other key areas of audio.

  • Bug Fixes
  1. Playlist save fix (will overwrite playlists with no confirmation)
    • Playlist are now stored by ID (ctx.message.id), this allows multiple playlist with the same name
  2. [p]playlist remove now converts a playlist to a custom one if it was created from a link
    • Before this part of the code was always ignored
  3. loadtrack keyerror fixed (#2711)
  4. Stop showing lavalink jar version in [p]audioset settings fixed ( #2880 )
  • Done
  1. Moved Playlist to a custom scope, there are 3 new custom scopes
    • Global Which only Bot Owner have edit access
    • Guild Which bot owners, DJ, Mods, Admins, Guild Owners, Authors have access to
    • User which bot owner and playlist author have access
  2. Playlists are now stored in Playlist object
  3. Created API's to easily access/modify/delete Playlists based on the ModLog structure
  4. Wrote a function that converts the old config schema to the new versions with the
  5. Update all playlist commands to use the new Playlist objects
  6. Rename Playlists command [p]playlist rename added
  7. V3 now have their own playlist schema that has song information, so when a playlist is uploaded no song information will need to be re-fetched, keeping support for V2 playlists
  8. Making a dynamic converter for the Playlist ID, so that users can give the bot either the Playlist ID or the playlist name, it will prompt user to select one if multiple matches are found
  9. Added [p]playlist update (If a playlist has a playlist url saved (non-custom playlist)) will now update the playlist to the latest tracks available.
  10. Child folders within "album" folders in localtracks (#270)
  11. Implemented LocalPath and Query data classes to handle queries and paths.
  12. Playlist now start playing after first song is loaded instead of waiting for the full playlist to load
  13. Lavalink response is now cacheable as part of #2890 (Significantly faster loading, 2.7K songs went from 1+ hours to 1-2 minutes on follow up enqueues)
  14. As part of the changes added by #2890 Users are no longer able to enqueue any tracks while a playlist is enqueuing, this is to ensure queue order persists. But since songs now start being played the moment they are loaded, This doesn't have a major negative impact to users.
  15. Dispatches for on_track_start, on_track_end, on_queue_end, on_track_enqueue, on_skip_track, on_auto_play_track
  16. Users can turn on autoplay so songs automatically play when the queue is empty
  17. Users can set one of their playlist to be used for auto play
  18. Adding and removing reactions are no longer blocking actions
  19. YouTube and Spotify API calls are also cacheable
  20. Cache for each level can be toggled individually
  21. Local tracks folder can be anywhere in your machine as long as your lavalink has perms to see the tracks.
  22. Rework localpath command to support new localpath logic
  23. Add command to Set cache age
  24. Make auto play playlist customizable
  25. url or keyword blacklist and whitelist
  26. Toggle for autopause when no one is in the channel (#721)
  27. [p]genre allows you to queue a Spotify playlist from a set of categories
  28. [p]playlist update shows the changes done to the playlist
  1. Full timestamp support added regardless of when the track is added
  2. Timestamp also work when searching for songs, if you use the services timestamp
  3. Queue order is fully correct when shuffle is on
  4. Allow skip with shuffle on
  5. Track Enqueue embeds now give the correct track number if shuffle is on
  6. Users can manually shuffle the queue with [p]queue shuffle
### Type - [x] Bugfix - [x] Enhancement - [x] New feature ### Description of the changes After discussing with @aikaterna she prefers everything in one PR so that conflicts and reviewing cross interaction and testing can be done more easily. This PR will superseded #2861 and #2890, in addition to those 2 I've done a lot more work on other key areas of audio. - **Bug Fixes** 1. Playlist save fix (will overwrite playlists with no confirmation) - Playlist are now stored by ID (`ctx.message.id`), this allows multiple playlist with the same name 2. `[p]playlist remove` now converts a playlist to a custom one if it was created from a link - Before this part of the code was always ignored 3. loadtrack keyerror fixed (#2711) 4. Stop showing lavalink jar version in `[p]audioset settings` fixed ( #2880 ) - **Done** 1. Moved Playlist to a custom scope, there are 3 new custom scopes - `Global` Which only Bot Owner have edit access - `Guild` Which bot owners, DJ, Mods, Admins, Guild Owners, Authors have access to - `User` which bot owner and playlist author have access 2. Playlists are now stored in `Playlist` object 3. Created API's to easily access/modify/delete Playlists based on the ModLog structure 4. Wrote a function that converts the old config schema to the new versions with the 5. Update all playlist commands to use the new `Playlist` objects 6. Rename Playlists command `[p]playlist rename` added 7. V3 now have their own playlist schema that has song information, so when a playlist is uploaded no song information will need to be re-fetched, keeping support for V2 playlists 8. Making a dynamic converter for the Playlist ID, so that users can give the bot either the Playlist ID or the playlist name, it will prompt user to select one if multiple matches are found 9. Added `[p]playlist update` (If a playlist has a playlist url saved (non-custom playlist)) will now update the playlist to the latest tracks available. 10. Child folders within "album" folders in localtracks (#270) 11. Implemented `LocalPath` and `Query` data classes to handle queries and paths. 12. Playlist now start playing after first song is loaded instead of waiting for the full playlist to load 13. Lavalink response is now cacheable as part of #2890 (Significantly faster loading, 2.7K songs went from 1+ hours to 1-2 minutes on follow up enqueues) 14. As part of the changes added by #2890 Users are no longer able to enqueue any tracks while a playlist is enqueuing, this is to ensure queue order persists. But since songs now start being played the moment they are loaded, This doesn't have a major negative impact to users. 15. Dispatches for on_track_start, on_track_end, on_queue_end, on_track_enqueue, on_skip_track, on_auto_play_track 16. Users can turn on autoplay so songs automatically play when the queue is empty 17. Users can set one of their playlist to be used for auto play 18. Adding and removing reactions are no longer blocking actions 19. YouTube and Spotify API calls are also cacheable 20. Cache for each level can be toggled individually 21. Local tracks folder can be anywhere in your machine as long as your lavalink has perms to see the tracks. 22. Rework localpath command to support new localpath logic 23. Add command to Set cache age 24. Make auto play playlist customizable 25. url or keyword blacklist and whitelist 26. Toggle for autopause when no one is in the channel (#721) 27. `[p]genre` allows you to queue a Spotify playlist from a set of categories 28. `[p]playlist update` shows the changes done to the playlist ## Requires https://github.com/Cog-Creators/Red-Lavalink/pull/61 as a dependency 1. Full timestamp support added regardless of when the track is added 2. Timestamp also work when searching for songs, if you use the services timestamp 3. Queue order is fully correct when shuffle is on 4. Allow skip with shuffle on 5. Track Enqueue embeds now give the correct track number if shuffle is on 6. Users can manually shuffle the queue with `[p]queue shuffle`
tekulvw (Migrated from github.com) reviewed 2019-07-26 13:26:23 +02:00
Twentysix26 (Migrated from github.com) reviewed 2019-07-26 13:26:23 +02:00
mikeshardmind (Migrated from github.com) reviewed 2019-07-26 13:26:23 +02:00
Drapersniper commented 2019-07-31 12:04:31 +02:00 (Migrated from github.com)

So I think it may be ready for review ....
I'm truly sorry for all the reviewers and QA's ... On the up side the code works ... on the downside i probably missed a fair amount of docs if you notice anything obvious don't hesitate to shout

So I think it may be ready for review .... I'm truly sorry for all the reviewers and QA's ... On the up side the code works ... on the downside i probably missed a fair amount of docs if you notice anything obvious don't hesitate to shout
mikeshardmind commented 2019-08-02 18:37:36 +02:00 (Migrated from github.com)

if you need.changes for red-lavalink, PR those and cross link it here. We cant handle the red-lavalink dep the way you have it here.

if you need.changes for red-lavalink, PR those and cross link it here. We cant handle the red-lavalink dep the way you have it here.
Drapersniper commented 2019-08-02 18:58:10 +02:00 (Migrated from github.com)

if you need.changes for red-lavalink, PR those and cross link it here. We cant handle the red-lavalink dep the way you have it here.

Yeah I know this was just for testing I fully intend to revert it to the correct way before this is merged

> if you need.changes for red-lavalink, PR those and cross link it here. We cant handle the red-lavalink dep the way you have it here. Yeah I know this was just for testing I fully intend to revert it to the correct way before this is merged
aikaterna (Migrated from github.com) requested changes 2019-09-26 20:00:55 +02:00
aikaterna (Migrated from github.com) left a comment

——
Run playlist download (there were multiple server playlists named the same thing as the query)
Get the file
The timeout replies with “Too many matches found and you did not select which one you wanted.” anyway, when it should return when the file is sent
——
Used the generated, downloaded file in playlist upload
Received:

[2019-09-26 10:12:34] [ERROR] red: ValueError
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/redbot/cogs/audio/audio.py", line 4782, in _playlist_upload
    scope_data=(scope, author, guild),
  File "/usr/local/lib/python3.7/site-packages/discord/ext/commands/context.py", line 132, in invoke
    ret = await command.callback(*arguments, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/redbot/cogs/audio/audio.py", line 4353, in _playlist_save
    scope, author, guild, specified_user = scope_data
ValueError: not enough values to unpack (expected 4, got 3)

——
Use playlist append with the DJ role on and use a user that does not have the DJ role
The reply responds with “You do not have the permissions to manage playlist owned by {username of the person who did the command}”
The reply should respond with the owner of the playlist instead

Playlist delete has this same issue
Playlist remove has this same issue
——
Have a pleb user queue a playlist so that they are the requester.
Turn on DJ role.
Use [p]skip on the pleb act

[2019-09-26 10:43:06] [ERROR] red: Exception in command 'skip'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/redbot/cogs/audio/audio.py", line 6150, in skip
    if is_requester and not can_skip and skip_to_track is None and skip_to_track > 1:
TypeError: '>' not supported between instances of 'NoneType' and 'int'

——
The “Playlist modified” embed header for playlist append when the appending playlist has already-saved tracks should be in title case to match other Audio embed titles.
——
Where is the auto pause setting referred to in 721.feature.rst?
——
So this review isn’t entirely asking for changes, just wanted to mention the genre command is really slick and a great addition.

—— Run playlist download (there were multiple server playlists named the same thing as the query) Get the file The timeout replies with “Too many matches found and you did not select which one you wanted.” anyway, when it should return when the file is sent —— Used the generated, downloaded file in playlist upload Received: ``` [2019-09-26 10:12:34] [ERROR] red: ValueError Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped ret = await coro(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/redbot/cogs/audio/audio.py", line 4782, in _playlist_upload scope_data=(scope, author, guild), File "/usr/local/lib/python3.7/site-packages/discord/ext/commands/context.py", line 132, in invoke ret = await command.callback(*arguments, **kwargs) File "/usr/local/lib/python3.7/site-packages/redbot/cogs/audio/audio.py", line 4353, in _playlist_save scope, author, guild, specified_user = scope_data ValueError: not enough values to unpack (expected 4, got 3) ``` —— Use playlist append with the DJ role on and use a user that does not have the DJ role The reply responds with “You do not have the permissions to manage playlist owned by {username of the person who did the command}” The reply should respond with the owner of the playlist instead Playlist delete has this same issue Playlist remove has this same issue —— Have a pleb user queue a playlist so that they are the requester. Turn on DJ role. Use [p]skip on the pleb act ``` [2019-09-26 10:43:06] [ERROR] red: Exception in command 'skip' Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/discord/ext/commands/core.py", line 79, in wrapped ret = await coro(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/redbot/cogs/audio/audio.py", line 6150, in skip if is_requester and not can_skip and skip_to_track is None and skip_to_track > 1: TypeError: '>' not supported between instances of 'NoneType' and 'int' ``` —— The “Playlist modified” embed header for playlist append when the appending playlist has already-saved tracks should be in title case to match other Audio embed titles. —— Where is the auto pause setting referred to in 721.feature.rst? —— So this review isn’t entirely asking for changes, just wanted to mention the genre command is really slick and a great addition.
Flame442 (Migrated from github.com) reviewed 2019-10-02 18:35:22 +02:00
@ -0,0 +1 @@
``[p]queue`` now works where there are no tracks in the queue (it shows the current track playing).
Flame442 (Migrated from github.com) commented 2019-10-02 18:33:47 +02:00

Should be "..where there are no tracks.."

Should be "..where there **are** no tracks.."
@ -0,0 +1 @@
``[p]seek`` and ``[p]skip`` can be used by user if they are the song requester while DJ mode is enabled, if votes are disabled.
Flame442 (Migrated from github.com) commented 2019-10-02 18:34:00 +02:00

[p]skip is missing a backtick

[p]skip is missing a backtick
aikaterna commented 2019-10-08 05:03:51 +02:00 (Migrated from github.com)

Playlist rename has “playlist update” in the help strings for the examples.

Playlist matching message should be changed.
Current: “{number} playlist match {name} Please try to be more specific or use the playlist ID.”
New: “{number} playlists match {name}: Please try to be more specific, or use the playlist ID.

Playlist update is able to be used by anyone, not just the author

Playlist dedupe message should be changed.
Current: “You do not have the permissions to manage playlist owned by {name}.”
New: “You do not have the permissions to manage {playlist name}, owned by {name}.” (Feel free to follow the format for Name/ID in other dialog boxes)
If it’s difficult to pull the playlist name at this point:
New: “You do not have the permissions to manage that playlist, which is owned by {name}.”

"""List all keywords added to the whitelist.""" is doubled.

Bump has some commented lines left in it.

Playlist rename has “playlist update” in the help strings for the examples. Playlist matching message should be changed. Current: “{number} playlist match {name} Please try to be more specific or use the playlist ID.” New: “{number} playlists match {name}: Please try to be more specific, or use the playlist ID. Playlist update is able to be used by anyone, not just the author Playlist dedupe message should be changed. Current: “You do not have the permissions to manage playlist owned by {name}.” New: “You do not have the permissions to manage {playlist name}, owned by {name}.” (Feel free to follow the format for Name/ID in other dialog boxes) If it’s difficult to pull the playlist name at this point: New: “You do not have the permissions to manage that playlist, which is owned by {name}.” """List all keywords added to the whitelist.""" is doubled. Bump has some commented lines left in it.
Cog-CreatorsBot (Migrated from github.com) approved these changes 2019-10-11 04:07:56 +02:00
Cog-CreatorsBot (Migrated from github.com) left a comment

Approved by aikaterna#1393

Approved by aikaterna#1393
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!2904
No description provided.