sigma67 / ytmusicapi

Unofficial API for YouTube Music
https://ytmusicapi.readthedocs.io
MIT License
1.59k stars 184 forks source link

script to setup test env #520

Closed jcbirdwell closed 4 months ago

jcbirdwell commented 5 months ago

Is your feature request related to a problem? Please describe. Austin mentioned it in their PR #517 and I wholeheartedly agree. I've probably spent about as much time setting up/fixing my test environment as I have actually contributing code and the setup almost dissuaded me from requesting the pull... It's a solution that I considered implementing during the tail end of my oauth overhaul when a bunch of errors seemed to stem from discrepancies in test.cfg setup, but didn't as it was already too long.

Describe the solution you'd like CLI python script similar to setup that walks you through adding oauth and browser auth (copy paste etc but writes the values both to files in the test dir by default and adds inputs to tests.cfg), creating the brand accounts (under their correct auth accounts), followed by a simple script for building out a suitable and standardized brand account library to run the tests against ie saving tracks, albums, creating playlists etc.

Describe alternatives you've considered DevOps is by no means my specialty so I'm open to suggestions in terms of fancy pipeline/pdm etc solutions, but I think even a partial implementation of the above spec would be well worth it. Further documentation of the test setup could alleviate some of the pain, but I'd consider it alone to be inadequate.

sigma67 commented 5 months ago

I agree and I'm aware of the issue. Not sure if creating the brand account is worth automating, I think it's not super trivial to do.

But filling the test.cfg could probably be done in an automated manner. Before automating should probably attempt to simplify that file though (fewer entries where not needed), to avoid too much effort.

jcbirdwell commented 5 months ago

Not sure if creating the brand account is worth automating, I think it's not super trivial to do.

Maybe not fully automated, but jumping the user to the correct links via webbrowser with some instruction might streamline the process.

But filling the test.cfg could probably be done in an automated manner. Before automating should probably attempt to simplify that file though

Automation of the brand account library contents would drastically simplify the test.cfg by removing the need for any of the limits, uploads, albums, playlists, and queries sections. Items to be added/kept in the brand account could be externalized to a json file.

(fewer entries where not needed), to avoid too much effort.

I would say lowering some of the current limit values would aid the creation process, like 300 library artists may be a bit excessive for an account only used for testing.

sigma67 commented 5 months ago

I see what you're getting at now with automatically populating a new brand account 👍 Great idea.

I think we could also narrow down the different accounts that are currently used to just three:

sigma67 commented 5 months ago

@jcbirdwell I added a script, feel free to review

sigma67 commented 4 months ago

To be fair I don't think the whole brand account for testing thing is realistic anymore. At least not without a change to YouTube's policy.

They have already banned my testing account due to their "spam" policy

sigma67 commented 4 months ago

After appealing they unblocked it again - so it seems they're not actively opposed, it's just automatically caught.