Closed BgueC6595 closed 6 months ago
After a quick discussion with pretty much the only active developer, we've decided this feature isn't worth adding, essentially we'd just be seeking to timestamps most of the time doing something like !chapters
would just return no chapters available, and with seek existing already at mosr you're saving yourself a couple seconds.
If it's got enough interest, some change to seek so it can list chapters might not be too hard.
In the mean time, if you'd really like the feature, here is a code snippet that might get close to what this feature is asking for:
async def cmd_chapters(self, player: MusicPlayer) -> CommandResponse:
"""
Usage:
{command_prefix}chapters
List chapter timestamps if available.
"""
if not player.current_entry:
raise exceptions.CommandError("No song currently playing, try again later.")
title = player.current_entry.title
chapters = player.current_entry.info.get("chapters", [])
if not isinstance(chapters, list) or len(chapters) == 0:
raise exceptions.CommandError(f"No chapters are available for `{title}`")
ts_list = ""
for chap in chapters:
s_time = chap.get("start_time", None)
if s_time is None:
continue
f_time = format_song_duration(s_time)
ts_list += f"`{f_time}`\n"
return Response(
f"**Chapters:**\n{ts_list}"
delete_after=30,
)
This hasn't been tested at all, and might need some changes. But could be a good place to start.
What new feature would you like to see?
Ideally people should be playing playlists instead of 3 hour music compilations. However some music videos have no alternatives.
In these instances it would be very nice if commands like "!chapter next" and "!chapter previous" were added, with maybe even a "!chapter list" (this could get too big, does youtube even have a limit?)
Might be too niche of a request, but I found myself using !seek to skip between chapters a lot so figured I'd put it out there.
Which of these categories fit your request?
New command
Just checking...
review
branch.