The purpose of this script is to create a playlist in YouTube Music that contains all of the songs in my YouTube Music Library. Since Google doesn't have a way to do that and I want to listen to everything on my Sonos 1 device.
pipenv run ytmusicapi oauth
And follow instructions. This command should create a oauth.json file in the
current directory that can be used by ytmusicapi
to modify my YouTube Music
account.
Use Black to format python code files. Settings should target the "stable" version, a line length of 100 characters, python version 3.10+, "Don't normalize string quotes or prefixes" (I prefer """Docstrings""" and 'single quoted' string values.), and "Format typing stubs" options.
Although it is possible to setup your editor to automatically format the code I have not done so because I still find cases where automatic formatters mangle the code. So I use the online sandbox linked above and then ignore some of the suggestions that I find ugly. This figures out some better white space solutions in python that I cannot always remember so I find it helpful.
It appears that YouTube Music will only allow 5,000 songs in a playlist. So in order to have all of my music and playlists I will need multiple lists. It also seems that Sonos will only load 500 tracks from a playlist that contains 5,000. Possibly by using SoCo library I might be able to add more tracks to the queue manually. I believe I've seen online that the maximum Sonnos queue size is 40,000 tracks.