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

can we get the year, genre and track number? #3

Open
ray2301 opened this issue Aug 21, 2023 · 3 comments
Open

can we get the year, genre and track number? #3

ray2301 opened this issue Aug 21, 2023 · 3 comments

Comments

@ray2301
Copy link

ray2301 commented Aug 21, 2023

hey, as the title says, can we?

i love this script. it's simple, it does what i needed and i don't see much problems with it at the moment :)
i did change some things if you want to look at it here.

i just have no idea how i could get the track, genre and year (or at least the year). can it even be done without making additional api calls to spotify?

edit: i really had a lot of issues with tagging the tracks properly and i think i finally got it. i was getting about 1000 tracks and each time i saw a file without tags, tracked the reason and made a change. in the end it's a little messy, but now every case that appeared for those 1000 tracks is properly tagged. here are the last changes i made for this if you find it useful. i made comments every time i saved it so they are there, somwhere. i don't really know how to fully use github :D

this has great stability since it runs slower (normal) than some other scripts that would first get all the tracks from the playlist and then starting to process them. since i need to process a playlist that has more than 3200 files, i would always get a 429 error on spotify (api limit) and since retries were made, the keys would got blocked for a huge amount of time. this works perfectly now everything is getting properly tagged and i'm just missing a little more info in the tags (genre, year, track number) and that is it. there's no need to do anything else :D this "provided toyoutube....."add-on i added to the search should help to get the audio results much more and ensure we're getting the best audio quality. the "audio" i added to the end ensures that even when the lyric video would come up as the first result, if audio exists it will be the first result. i checked a bunch of songs until now and they are all the right versions.

thank you for this. a lot!

@wdmvv
Copy link
Owner

wdmvv commented Aug 22, 2023

Hello there
I probably see what do you mean - this can easily be implemented. I am using this endpoint for getting tracks, release date and genre(s) are there. However, I dont get track number part - it already is a thing for album downloads, should I add to the playlist download as well? If yes, then this is not a problem either - track number is there as well, so I should modify spotify.py to count there arguments as well. So, answering your question: we indeed can

Regarding your commit:

  • I added geobypass to avoid situations, where one song is on spotify, but it is not available in some region. Maybe this does absolutely nothing, but it does not affect anything either, so I'd rather have it be there
  • preferredcodec - I'd rather not have m4a, instead I will try adding various codecs support
  • Why? I aimed at 1:1 download quality, so why would I change output filename, which MAY be different from spotify's. However, sanitized track name should be used in query part, so I will add this. I did see your comment about track getting properly indexed, so instead I might simply rename it back to original after applying metadata changes
  • Overwrite check part - okay, I will add something like this in the future
  • I, however, will not remove this. Change metadata function uses albums from self.album_covers structure, so ,say, if we download same album, then it will download album cover image once only, in your case it will download it each time since artwork is deleted each time metadata is changed.

@ray2301
Copy link
Author

ray2301 commented Aug 22, 2023

i couldn't really pinpoint how to get the year at least. i like to have them in a library so if a year is present i can make local automatic playlists based on decades. the more info i have in the tags, the better. when i have lyrics in tags, i can even play songs based on a same phrase in the lyrics. i mean, track name comes from the album so it's just natural to have it. it's not that it's so important to me :) it could also be track number from the playlist. or that doesn't even have to be there. but when you have 3200 unique songs and a library, when you open the artist and that album, there are multiple songs from it so when they are sorted by track number it's just - normal :) i could always get those empty tags with an automatic tagger later since there's enough data to fill that all in on autopilot.

i didn't really do anything to try to commit those changes. i was searching and searching for a done thing that i would just open up and run and go to sleep but in the end it started to get fun :) all the preferences and all the changes i made were based on my personal needs so that's how it stayed. i like m4a, got used to it a long time ago. but i was there when mp3 got born so there were a lot of formats i liked and hoped would evolve more. i don't really see a big difference between those two but on lower bitrates, m4a can sound better when you need low bitrate streaming but today with the internet speeds, the bandwith kind of doesn't really matter anymore. i like to save space, i don't expect to stop my spotify and tidal accounts for this but i wanted to have a backup of my accumulated liked tracks and a huge playlist i have with everything that ever made me put it to a playlist so i don't ever lose it again. at this point i just might have this urge to save something so i don't lose it so this came to my mind :D

anyway, this script now works perfectly for me. i actually implemented fuzzy search so i can be sure the track name at least always matches at least 80% to the original so i can further try to remove any possibility for a wrong track and i'll possibly have some more fun with it these days.

with the full set of tag data you can pull, this is the most perfect script for this purpose. especially if it gets more and more precise in getting the correct track and the best possible audio version from youtube.

regarding the covers, i know they will always be redownloaded for me but in 3000+ file playlist there are not much full albums so there were hundreds of photos in the same folder as the files. i couldn't catch what was happening with the files from the clutter. instead of thinking right then to just move the temporary photos to another folder before they get deleted in the end, i went to change that. it was probably the first thing to think of cause for me, that will never be a problem since i don't really download albums. but yeah - i told you it's a mess and you take from it what you can to improve it.

i would just like to see the year and genre in the tags :D

@ray2301
Copy link
Author

ray2301 commented Aug 26, 2023

just wanted to let you know i finished the game of playing with the downloader.py and now it does exactly what i needed.
while i was saving, i left a bunch of comments in the descriptions so if you're interested and in the future want to go that way with some of it, i'm leaving it to you here :)
there's probably much to remove or fix still, but it matches really really good now.

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

No branches or pull requests

2 participants