[Audio] Autoplay failure with User scope playlist #6281

Closed
opened 2023-12-29 21:54:01 +01:00 by aikaterna · 4 comments
aikaterna commented 2023-12-29 21:54:01 +01:00 (Migrated from github.com)

What Red version are you using?

3.5.5

Cog name

Audio

Command name

autoplay

What did you expect to happen?

I expected a Red playlist saved with the User scope would be able to be used as an autoplay playlist.

What actually happened?

A User scoped playlist, set in [p]audioset autoplay playlist, is never started on bot start nor does [p]autoplay queue a song from that playlist.

In running in verbose mode, this traceback is offered on bot start or while using [p]autoplay.

VERBOSE [red.cogs.Audio.api.AudioAPIInterface] Failed to fetch playlist for autoplay
Traceback (most recent call last) 
/Users/aikaterna/red38/lib/python3.8/site-packages/redbot/cogs/audio/apis/interface.py:938 in autoplay
❱ 938 playlist = await get_playlist(
/Users/aikaterna/red38/lib/python3.8/site-packages/redbot/cogs/audio/apis/playlist_interface.py:392 in get_playlist
❱ 392 raise RuntimeError(f"That playlist does not exist for the following scope: {scope}") 
RuntimeError: That playlist does not exist for the following scope: USERPLAYLIST

User scoped playlists are saved in the SQL db as the user ID as the value in the scope_id column. However, when loading playlists with the get_playlist function, we are passing in the bot's ID instead of the playlist owner's user ID, which causes the lookup to fail on User scoped playlists.

github.com/Cog-Creators/Red-DiscordBot@76abb7cab2/redbot/cogs/audio/apis/interface.py (L940)

The autoplaylist config value we're looking at to start that get_playlist lookup only offers the playlist ID, so not sure if we should be doing another lookup at that point to fetch the true author instead of assuming it's the bot ID.

How can we reproduce this error?

  1. Have the bot running in verbose debug mode to view the traceback
  2. Set a User scoped playlist as the playlist in [p]audioset autoplay playlist
  3. Use [p]autoplay or set autoplay to start with [p]audioset autoplay toggle and then restart the bot

Anything else?

Additional context:
The fact that user playlists don't work for auto play is intentional - because auto play is a guild level feature meaning guild and global scoped playlists should work for it, but user not so, as we may exposing user data to users in a server that the playlist author/manager is no longer in.
There should be an error show to the user when trying to set a user scoped playlist as an autoplay playlist.

### What Red version are you using? 3.5.5 ### Cog name Audio ### Command name autoplay ### What did you expect to happen? I expected a Red playlist saved with the User scope would be able to be used as an autoplay playlist. ### What actually happened? A User scoped playlist, set in [p]audioset autoplay playlist, is never started on bot start nor does [p]autoplay queue a song from that playlist. In running in verbose mode, this traceback is offered on bot start or while using [p]autoplay. ``` VERBOSE [red.cogs.Audio.api.AudioAPIInterface] Failed to fetch playlist for autoplay Traceback (most recent call last) /Users/aikaterna/red38/lib/python3.8/site-packages/redbot/cogs/audio/apis/interface.py:938 in autoplay ❱ 938 playlist = await get_playlist( /Users/aikaterna/red38/lib/python3.8/site-packages/redbot/cogs/audio/apis/playlist_interface.py:392 in get_playlist ❱ 392 raise RuntimeError(f"That playlist does not exist for the following scope: {scope}") RuntimeError: That playlist does not exist for the following scope: USERPLAYLIST ``` User scoped playlists are saved in the SQL db as the user ID as the value in the scope_id column. However, when loading playlists with the get_playlist function, we are passing in the bot's ID instead of the playlist owner's user ID, which causes the lookup to fail on User scoped playlists. https://github.com/Cog-Creators/Red-DiscordBot/blob/76abb7cab2c28bda3ad5e939b3d07250cdd99d7f/redbot/cogs/audio/apis/interface.py#L940 The autoplaylist config value we're looking at to start that get_playlist lookup only offers the playlist ID, so not sure if we should be doing another lookup at that point to fetch the true author instead of assuming it's the bot ID. ### How can we reproduce this error? 1. Have the bot running in verbose debug mode to view the traceback 2. Set a User scoped playlist as the playlist in [p]audioset autoplay playlist 3. Use [p]autoplay or set autoplay to start with [p]audioset autoplay toggle and then restart the bot ### Anything else? Additional context: The fact that user playlists don't work for auto play is intentional - because auto play is a guild level feature meaning guild and global scoped playlists should work for it, but user not so, as we may exposing user data to users in a server that the playlist author/manager is no longer in. There should be an error show to the user when trying to set a user scoped playlist as an autoplay playlist.
sxliang3093 commented 2024-04-02 10:03:03 +02:00 (Migrated from github.com)

Hey! I would love to work on this! Thank you

Hey! I would love to work on this! Thank you
sxliang3093 commented 2024-04-11 05:25:16 +02:00 (Migrated from github.com)

I was wondering if the project manager could assign me this issue? Thanks!

I was wondering if the project manager could assign me this issue? Thanks!
Flame442 commented 2024-04-11 06:04:33 +02:00 (Migrated from github.com)

@sxliang3093, You are free to create a PR for any issue labeled as "Accepted" or "PRs welcome". We don't generally assign people to issues outside of core contributors. When we don't have a great line of communication with a contributor and don't have a PR already created, we don't know if/when they decide to abandon working on the issue. If you create a PR, it will be linked to this issue to make it clear that it is in active development, and we can see the progress towards fixing this issue. Feel free to label your PR as a draft if you have not yet fully resolved this issue.

If you need any additional help contributing, feel free to reach out in our discord support server.

@sxliang3093, You are free to create a PR for any issue labeled as "Accepted" or "PRs welcome". We don't generally assign people to issues outside of core contributors. When we don't have a great line of communication with a contributor and don't have a PR already created, we don't know if/when they decide to abandon working on the issue. If you create a PR, it will be linked to this issue to make it clear that it is in active development, and we can see the progress towards fixing this issue. Feel free to label your PR as a draft if you have not yet fully resolved this issue. If you need any additional help contributing, feel free to reach out in our [discord support server](https://discord.gg/red).
Owner

Behoben in bd2210486: Wie im Issue beschrieben, sind User-Playlists für Autoplay absichtlich nicht vorgesehen. [p]audioset autoplay playlist lehnt sie jetzt mit einer klaren Meldung ab, statt sie zu speichern und dann still zu scheitern. Die Hilfe des Befehls ist angepasst.


Generated by Claude Code

Behoben in bd2210486: Wie im Issue beschrieben, sind User-Playlists für Autoplay absichtlich nicht vorgesehen. `[p]audioset autoplay playlist` lehnt sie jetzt mit einer klaren Meldung ab, statt sie zu speichern und dann still zu scheitern. Die Hilfe des Befehls ist angepasst. --- _Generated by [Claude Code](https://claude.ai/code)_
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
2 participants
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#6281
No description provided.