Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add-playlist only queueing and not playing #21

Closed
pritam20ps05 opened this issue May 4, 2022 · 2 comments · Fixed by #22
Closed

add-playlist only queueing and not playing #21

pritam20ps05 opened this issue May 4, 2022 · 2 comments · Fixed by #22
Labels
bug Something isn't working

Comments

@pritam20ps05
Copy link
Owner

This problem has been caused due to making the add songs ytdl fetcher async. Now the eventloop dose not wait for adding a song and skips to check queue func which exits as queue is still empty.

Solution: downgrade add songs func ytdl fetcher from async to sync

@pritam20ps05
Copy link
Owner Author

Also add better url parsing which depends on 'list=' rather than the domain

@pritam20ps05 pritam20ps05 added the bug Something isn't working label May 4, 2022
@pritam20ps05
Copy link
Owner Author

code:

async def addsongs(entries, ctx):
    for song in entries:
        url = song["url"]
        try:
            with YoutubeDL(YDL_OPTIONS) as ydl:
                info = ydl.extract_info(url, download=False)

            data = {
                "link": info['url'],
                "url": url,
                "title": info['title'],
                "thumbnails": info["thumbnails"],
                "raw": info
            }
            queues[ctx.guild.id].append(data)
        except Exception as e:
            print(e)
        await asyncio.sleep(2)
    embed=discord.Embed(title="Playlist items were added to queue", color=0xfe4b81)
    await ctx.send(embed=embed)

@pritam20ps05 pritam20ps05 linked a pull request May 4, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant