sigma67 / spotify_to_ytmusic

Clone a Spotify playlist to YouTube Music
MIT License
949 stars 72 forks source link

Cache conversions #39

Open mrmbernardi opened 2 years ago

mrmbernardi commented 2 years ago

I'm trying to transfer a playlist of 1792 songs from spotify to youtube. On my first attempt I got 920/1792 converted before encountering this error:

Could not transfer playlist 1792. ExceptionHTTPSConnectionPool(host='music.youtube.com', port=443): Read timed out. (read timeout=30)

I go to retry the command and this time I get to 460 songs before I get a similar read timeout error.

If the program would cache the conversions it's already made, I would be able to keep running this command until it converts all the songs and completes successfully, but without this it's up to chance as it starts from the beginning every time.

guglielmobartelloni commented 2 years ago

If you want, in my spare time, I can try to implement it. It shouldn't be too difficult

mrmbernardi commented 2 years ago

I got my playlist converted successfully, but it would definitely help future users with the same issue if you implemented it.

As an aside, I'm not sure why I was getting the read time outs. I have a solid connection, I'm thinking it may have been load shedding on youtube's end?

sigma67 commented 2 years ago

It's a good idea, but it would require some sort of local database mapping search strings to videoIds. The simplest option would be some sort of text file, ideally not requiring new dependencies. I think caching should be made optional through an opt-in parameter --cache, as search results can and do change over time.

sigma67 commented 1 year ago

@guglielmobartelloni are you still interested in implementing this? Feel free to make suggestions for an implementation

sigma67 commented 1 year ago

Feel free to check out the first draft here: https://github.com/sigma67/spotify_to_ytmusic/tree/39-cache-conversions

I think we will need a CLI to interact with the cache as well: