
Last.Fm Genre Tagger
Source (link to git-repo or to original if based on someone elses unmodified work):
Dependencies
ruby
ruby-taglib
kdialog (kdebase on my distro)
kdialog is not required to run
If anyone has pointers on how to rescan single files in the collection database, I would be glad to hear them.
Known Issues:
Amarok database isn't updated before a collection rescan
Script crashes on wma files (who wants to use those anyway)
0.3.3:
Blacklist is now configurable from the configure menu.
If you don't have kdialog installed then edit the file manually at ~/.kde/share/apps/amarok/script-data/genre-tagger.csv
0.3.2:
Genre information is now capitalized
0.3.1:
Fixed bug which caused script to exit if title contains illegal characters
Fixed bug which didn't allow the script to try fallback data on fail.
0.3.0:
Implemented a very basic blacklist functionality. Must be updated manually in lastfm_genre.rb on line 68
Script now defaults to title search with fallback on album, and artist. default search priority must be set in lines 43 - 48
0.2.0:
Don't crash if connection to last.fm fails
Possibility to select between artist,album and title for tag search. NOTE: No gui option yet. Change it manually on lines 45-47 in lastfm_genre.rb
0.1.1:
Fixed bug caused by spaces in URL
Ratings & Comments
20 Comments
hey there, do you think it's possible to tag not only songs you are playing, but all collection at once? maybe through command-line? because if i listen to one song from an album, i get it updated but the others are not... great script though! thanks!
Hey! First of all, GREAT SCRIPT! ^ ^ But I notice than the genre its added to the ID3tag, but not in the amarok database. The thing its than if I'm go to the song info, the genre it's changed. It show the new genre fetched by the script, but in the genre column in the track list, or in the inteligent track lists by genre....it's the same at before using it. I'm doing something grong? It's there some trick to update the all the info at once?
Finally got this script to work on OpenSuse 10.3 after installing ruby-taglib and taglib-devel. Problem now is, that it seems to take just any tag from last.fm instead of the most popular one. For instance the band SOiL got the genre "Music that rocks a lot" while the top tag is "metal" (see: http://www.lastfm.de/music/SOiL )
If I may post another case, some bands just get their names as genre. The band Earshot for example. http://www.lastfm.de/music/Earshot
I too got the incorrect genre when the band's name was the most popular tag. I fixed this by changing the line in the "get_genre(artist,album,title)" procedure to read "if (not blacklisted(current) and current != artist) then" It was just a guess on my part (I know no ruby) but it seems to work.
OK, must have to do with title-tagging. How do I change priority? Lines must have changed since 0.2.0, but I don't know any ruby. Could it be lines 56-58? Please make this configurable or at least comment the code accordingly.
An earlier request made me default to title tag. It's only a matter of what order they are in on lines 56-58, ill make it an configurable option later. and perhaps start commenting my code, hehe. its my first release into "the wild" so commenting is not something im used to put to much effort into.
Thanx for confirming my guess. *g* And many thanks for this cool script.
hey, your appp sounds good, but I cant get it working here. I got opensuse 10.3 with KDE but I cant install the ruby-taglib. I had a look at the page, but Iḿ a noob, so I didnt understand the installation guide. Anybody willing to help me? THX Fin-Fin
Hello! I really like your script, it's something I've been wanting for a while actually. One very minor change that could potentially be an option is to capitalize the genre tag. I'm pretty anal when it comes to tagging my music, and it would be useful to at least set that option. I hard coded it in for now, since I don't need lowercase tags ever, but perhaps for other users it would be helpful Thanks!
Actually I was just thinking that last I checked what tags it had retrieved. It will be Capitalized in next release
Yay. I can't wait.
Hello Yes some time after posting the comment, i installed that missing lib and the plugin could start, but, i still don't have any context option, and at some point i had some connection error which seemed to randomly pop up (gentoo here). Here's a suggestion of what you may use as genre list , listing all of them should be extensive enought in >90% of cases http://www.jamendo.com/en/albums (right side) http://www.last.fm/music/+tags/ http://verseguru.com/?music/list%7Cgenre The little issue i have with blacklists is that i have no idea how you could fill that (lot of manual filling ?). Maybe add "www" in the blacklist it should work in a lot of cases, even stuff like "listen" shouldn't be in a blacklist because of "easy listening". As for the match i'd suggest some fuzzy match, but something like no more than 2 characters to avoid something like "best _rock_ in the world".
Hello If i was you i d better try to find a place that list a lot of different tags/music genre, then use this as a whitelist, maybe do stuff like not be case sensitive or fuzzy match in case stuf is misstyped. But i can hardly imageine you can list all the bullshit peoples use as tag, whereas, there are something like 20-30 tags which must amount for >90% of genre tag. Btw i get an error when trying to run your script ... a bit too lazy to check why now, i guess i ll wait for the next update.
My guess is that you are missing ruby-taglib (http://www.hakubi.us/ruby-taglib/), which in my case (arch linux) was the only library that didn't came with the ruby package. Almost all suggestions require me to figure out how to make a configuration dialog. So i think i'll implement a possibility for both white and blacklist.
You could use a blacklist, look here: http://www.kde-apps.org/content/show.php/synctags?content=49583
Good idea, ill put i on my todo. Just need to find out a generic way of doing dialogs. kdialog is packaged deep inside some kde package, and im using gnome.
I have a change for you: For me it's better using the top tag for the track, not for the artist. I have changed your script. Tell me if you want it. Maybe you can make your script configurable.
My original plan was to use tags for albums, but i dropped the idea when I saw some albums with top tag like "got this album". I suspect that single track tags are even worse on that account. But im not against putting it as a posibillity in configuration
and by the way, yes, i would like to see your changes