Open Otoris opened 8 years ago
Don't YT files have ID3 tags in them anyway?
It is possible to implement this. I recently wrote which grabs just album art for all your downloaded songs, you can try it : http://iyask.me/fixalbumart/ I'll work on it if I get some time in weekend.
I tried implementing youtube-dl's "--metadata-from-title" and "--add-metadata" but things weren't turning out well. I tried downloading Only Love by Mumford and Sons and it thought the title was "Only Love - Mumford and" and the artist was "Sons".
I'd be willing to add this feature if anyone has any ideas of pulling the metadata from the youtube download.
Added this feature in commit https://github.com/yask123/Instant-Music-Downloader/commit/71145bc3e0cf2eba5e7b2aa3082cd38d13ae66ad
Update sudo pip install instantmusic --upgrade
to try.
Not closing this issue since Its not 100% complete.
Currently it assumes the song tittle in youtube is written as Artist name - Song name
which is true in most of the cases.
Thus it currently doesn't write album
name.
I plan to fix this in future. See: https://github.com/yask123/Instant-Music-Downloader/blob/master/README.md#mp3-tags
Something like gracenote or ACRCloud could be used to grab metadata. Only issue is it requires uploading at least a part of the song after it is downloaded by youtube-dl.
Musicbrainz requires you to fingerprint and send the song. This could be used instead of uploading the entire song.
AcoustID lookups only work for what's already in the database and I don't think anyone has ever submitted IDs of youtube videos before, so that method probably won't work!
Damn :disappointed:
Only alternative I can think of is to do google search with song tittle and scrape meta data from websites ?
@dufferzafar I think it might work for YouTube videos. As far as I know, it matches the fingerprint of the song. It doesn't really matter where you download it from as long as that song is in the database.
@ssundarraj It didn't work, I tried multiple times with different songs downloaded from youtube.
I found something the other day. It was called EchoNest. It might work. On Oct 14, 2015 8:49 AM, "Yask Srivastava" notifications@github.com wrote:
@ssundarraj https://github.com/ssundarraj It didn't work, I tried multiple times with different songs downloaded from youtube.
— Reply to this email directly or view it on GitHub https://github.com/yask123/Instant-Music-Downloader/issues/38#issuecomment-148040056 .
Tried this hack to grab album name
album_name=''
try:
url = 'http://www.google.com/search?q='+qp(title)
req = requests.get(url)
response = req.content
result=str(response)
link_start=result.find('http://www.metrolyrics.com')
link_end=result.find('html',link_start+1)
link = result[link_start:link_end+4]
lyrics_html = link
a = requests.get(lyrics_html)
html_doc= a.content
soup = BeautifulSoup(html_doc, 'html.parser')
album_name = soup.find(id = "album-name-link").text
except:
print ('Album name not found')
Tested multiple times with different songs, seems to work for most of them.
It would work for songs which have their lyrics in metrolyrics.com
. From there I am scraping the meta data.
Eg: http://www.metrolyrics.com/21-guns-lyrics-green-day.html
from 21st Century Breakdown
Pushed it to the source: bd2d28bff904bd3d5e27ab4c9984f5cc5ea70c6a
This will embed artist name, song title, album name, album art
.
Have a look here: https://github.com/yask123/Instant-Music-Downloader/blob/master/instantmusic-0.1/bin/instantmusic#L123
Since I haven't updated the package yet, run
$ subl
which instantmusic``
Replace subl
with whichever code editor you use, and replace all code with: https://github.com/yask123/Instant-Music-Downloader/blob/master/instantmusic-0.1/bin/instantmusic
Updated package.
Run pip install instantmusic --upgrade
to try.
@yask123 I notice in the above picture the song has the last character cut off.
I am experiencing this too - the actual filename is fine but whenever I open it in any media player (Plex, iTunes, cmus) it's cut off. Any idea what that could be?
@semaj Thanks for reporting. Yes this issue exists. It's a minor bug (Indexes for slicing text are not accurate). I'll fix this bug after my exams get over (5th December).
What if this could grab the relevant file metadata + file title and apply it after it's been downloaded from YouTube automagically? Would definitely help keep an iTunes library clean.