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 ytdl search #210

Merged
merged 5 commits into from
Dec 12, 2023
Merged

Add ytdl search #210

merged 5 commits into from
Dec 12, 2023

Conversation

cycle-five
Copy link
Contributor

@cycle-five cycle-five commented Dec 4, 2023

Adds to YoutubeDl the ability to just return the search results as text.

@cycle-five
Copy link
Contributor Author

What are your linter settings? Mine seem to be conflicting.

@GnomedDev
Copy link
Member

You need to run cargo +nightly fmt.

Copy link
Member

@FelixMcFelix FelixMcFelix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this feature is needed and useful, but there's work needing done to make it fit and function as expected if you're able to.

src/input/compose.rs Outdated Show resolved Hide resolved
src/input/sources/ytdl.rs Outdated Show resolved Hide resolved
src/input/sources/ytdl.rs Outdated Show resolved Hide resolved
src/input/sources/ytdl.rs Outdated Show resolved Hide resolved
src/input/sources/ytdl.rs Outdated Show resolved Hide resolved
src/input/sources/ytdl.rs Outdated Show resolved Hide resolved
@cycle-five
Copy link
Contributor Author

I should have commented originally with the impetus for this feature. I am currently using it in my bot, albeit it is not fully implemented, however the entire purpose is to do a search and return options which the client can then choose from, before it plays the song.

@cycle-five
Copy link
Contributor Author

I think that this feature is needed and useful, but there's work needing done to make it fit and function as expected if you're able to.

I am more than happy to work on this to have it fit properly into songbird, it is absolutely needed for a feature I'm using in my bot, so as long as I can make that work, I'm happy to make whatever changes you feel are appropriate.

@FelixMcFelix
Copy link
Member

Thanks, I'm just keen that it works great for everyone. The main assumption with Compose is that you should be able to 'just play it', ideally. I.e., new_yt_search should produce an object that will play a search result, or produce a different struct entirely (which does not support Compose). I hope that makes sense?

@cycle-five cycle-five force-pushed the ytdl-search branch 2 times, most recently from f14ed6d to 29ba8c4 Compare December 7, 2023 06:35
@cycle-five
Copy link
Contributor Author

I believe I've made all the requested changes and have got it working with these changes in my bot (which of course is the most important piece in this equation).

I feel that my approach to using the yt-dlp search feature and parsing that into the AuxMetadata is either exactly as it is intended, or completely wrong.

Also for the future I believe yt-dlp may support other searches, and also are there plans to not need yt-dlp?

@FelixMcFelix
Copy link
Member

Thanks for making changes, I'll take a proper look in the next few days.

I feel that my approach to using the yt-dlp search feature and parsing that into the AuxMetadata is either exactly as it is intended, or completely wrong.

It looks valid at a glance, thank you. If there are any changes then I'll either push to your branch or provide a patchset.

Also for the future I believe yt-dlp may support other searches,

We can support these as and when they come up.

and also are there plans to not need yt-dlp?

You don't need yt-dlp for songbird, but practically speaking you need it to get any usable data from youtube given the way it works.

Refactors such that parsing of (ND)JSON is handled in only one location
now, which allows us to greatly simplify the actual `search` method. The
main change is that any `new_search` is now instantly playable.
@FelixMcFelix FelixMcFelix dismissed their stale review December 9, 2023 15:15

Applied own fixes.

@FelixMcFelix
Copy link
Member

@cycle-five please have a look and see that you're okay with the changes I've made here:

  • a search query is now playable as users would expect.
  • search now calls into the same yt-dlp invocation and parsing logic as query.
  • tests have been altered: relying on a specific test result's metadata is a bit flaky. Equally, we really want to make sure we're using sources which are creative-commons or similarly licensed.

@cycle-five
Copy link
Contributor Author

Awesome! I'm just going to pull this update and make sure my bot can integrate apropos.

@cycle-five
Copy link
Contributor Author

This works exactly as I need, so it has my OK.

@FelixMcFelix FelixMcFelix merged commit d681b71 into serenity-rs:current Dec 12, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants